Skip to content

Commit 398ca0f

Browse files
authored
docs(sveltekit): Add more source maps upload documentation (#7844)
1 parent 21a975e commit 398ca0f

File tree

1 file changed

+83
-4
lines changed

1 file changed

+83
-4
lines changed

packages/sveltekit/README.md

Lines changed: 83 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,15 +165,94 @@ The Sentry SvelteKit SDK mostly relies on [SvelteKit Hooks](https://kit.svelte.d
165165

166166
This adds the [Sentry Vite Plugin](https://github.com/getsentry/sentry-javascript-bundler-plugins/tree/main/packages/vite-plugin) to your Vite config to automatically upload source maps to Sentry.
167167

168+
## Uploading Source Maps
169+
170+
After completing the [Vite Setup](#5-vite-setup), the SDK will automatically upload source maps to Sentry, when you
171+
build your project. However, you still need to specify your Sentry auth token as well as your org and project slugs. You
172+
can either set them as env variables (for example in a `.env` file):
173+
174+
- `SENTRY_ORG` your Sentry org slug
175+
- `SENTRY_PROJECT` your Sentry project slug
176+
- `SENTRY_AUTH_TOKEN` your Sentry auth token
177+
178+
Or you can pass them in whatever form you prefer to `sentrySvelteKit`:
179+
180+
```js
181+
// vite.config.js
182+
import { sveltekit } from '@sveltejs/kit/vite';
183+
import { sentrySvelteKit } from '@sentry/sveltekit';
184+
185+
export default {
186+
plugins: [
187+
sentrySvelteKit({
188+
sourceMapsUploadOptions: {
189+
org: 'my-org-slug',
190+
project: 'my-project-slug',
191+
authToken: process.env.SENTRY_AUTH_TOKEN,
192+
},
193+
}),
194+
sveltekit(),
195+
],
196+
// ... rest of your Vite config
197+
};
198+
```
199+
200+
### Configuring Source maps upload
201+
202+
Under `sourceMapsUploadOptions`, you can also specify all additional options supported by the
203+
[Sentry Vite Plugin](https://github.com/getsentry/sentry-javascript-bundler-plugins/blob/main/packages/vite-plugin/README.md#configuration).
204+
This might be useful if you're using adapters other than the Node adapter or have a more customized build setup.
205+
206+
```js
207+
// vite.config.js
208+
import { sveltekit } from '@sveltejs/kit/vite';
209+
import { sentrySvelteKit } from '@sentry/sveltekit';
210+
211+
export default {
212+
plugins: [
213+
sentrySvelteKit({
214+
sourceMapsUploadOptions: {
215+
org: 'my-org-slug',
216+
project: 'my-project-slug',
217+
authToken: 'process.env.SENTRY_AUTH_TOKEN',
218+
include: ['dist'],
219+
cleanArtifacts: true,
220+
setCommits: {
221+
auto: true,
222+
},
223+
},
224+
}),
225+
sveltekit(),
226+
],
227+
// ... rest of your Vite config
228+
};
229+
```
230+
231+
### Disabeling automatic source map upload
232+
233+
If you don't want to upload source maps automatically, you can disable it as follows:
234+
235+
```js
236+
// vite.config.js
237+
import { sveltekit } from '@sveltejs/kit/vite';
238+
import { sentrySvelteKit } from '@sentry/sveltekit';
239+
240+
export default {
241+
plugins: [
242+
sentrySvelteKit({
243+
autoUploadSourceMaps: false,
244+
}),
245+
sveltekit(),
246+
],
247+
// ... rest of your Vite config
248+
};
249+
```
250+
168251
## Known Limitations
169252

170253
This SDK is still under active development and several features are missing.
171254
Take a look at our [SvelteKit SDK Development Roadmap](https://github.com/getsentry/sentry-javascript/issues/6692) to follow the progress:
172255

173-
- **Source Maps** upload is not yet working correctly.
174-
We already investigated [some options](https://github.com/getsentry/sentry-javascript/discussions/5838#discussioncomment-4696985) but uploading source maps doesn't work automtatically out of the box yet.
175-
This will be addressed next, as we release the next alpha builds.
176-
177256
- **Adapters** other than `@sveltejs/adapter-node` are currently not supported.
178257
We haven't yet tested other platforms like Vercel.
179258
This is on our roadmap but it will come at a later time.

0 commit comments

Comments
 (0)