Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/sveltekit/src/vite/sentryVitePlugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export async function sentrySvelteKit(options: SentrySvelteKitPluginOptions = {}
);
}

if (mergedOptions.autoUploadSourceMaps) {
if (mergedOptions.autoUploadSourceMaps && process.env.NODE_ENV !== 'development') {
const pluginOptions = {
...mergedOptions.sourceMapsUploadOptions,
debug: mergedOptions.debug, // override the plugin's debug flag with the one from the top-level options
Expand Down
13 changes: 13 additions & 0 deletions packages/sveltekit/test/vite/sentrySvelteKitPlugins.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,19 @@ describe('sentryVite()', () => {
expect(plugins).toHaveLength(1);
});

it("doesn't return the custom sentry source maps plugin if `NODE_ENV` is development", async () => {
const previousEnv = process.env.NODE_ENV;

process.env.NODE_ENV = 'development';
const plugins = await sentrySvelteKit({ autoUploadSourceMaps: true, autoInstrument: true });
const instrumentPlugin = plugins[0];

expect(plugins).toHaveLength(1);
expect(instrumentPlugin.name).toEqual('sentry-auto-instrumentation');

process.env.NODE_ENV = previousEnv;
});

it("doesn't return the auto instrument plugin if autoInstrument is `false`", async () => {
const plugins = await sentrySvelteKit({ autoInstrument: false });
expect(plugins).toHaveLength(1);
Expand Down