|
1 | 1 | import type { Options as SentryBundlerPluginOptions } from '@sentry/bundler-plugin-core'; |
2 | | -import { debug } from '@sentry/core'; |
3 | 2 | import type { NitroConfig } from 'nitro/types'; |
4 | 3 | import { createNitroModule } from './module'; |
| 4 | +import { configureSourcemapSettings } from './sourceMaps'; |
5 | 5 |
|
6 | 6 | export type SentryNitroOptions = Pick< |
7 | 7 | SentryBundlerPluginOptions, |
@@ -40,33 +40,10 @@ export function setupSentryNitroModule( |
40 | 40 | config.tracingChannel = true; |
41 | 41 | } |
42 | 42 |
|
43 | | - const sourcemapUploadDisabled = moduleOptions?.sourcemaps?.disable === true || moduleOptions?.disable === true; |
44 | | - |
45 | | - if (!sourcemapUploadDisabled) { |
46 | | - configureSourcemapSettings(config, moduleOptions); |
47 | | - } |
| 43 | + configureSourcemapSettings(config, moduleOptions); |
48 | 44 |
|
49 | 45 | config.modules = config.modules || []; |
50 | 46 | config.modules.push(createNitroModule(moduleOptions)); |
51 | 47 |
|
52 | 48 | return config; |
53 | 49 | } |
54 | | - |
55 | | -function configureSourcemapSettings(config: NitroConfig, moduleOptions?: SentryNitroOptions): void { |
56 | | - if (config.sourcemap === false) { |
57 | | - debug.warn( |
58 | | - '[Sentry] You have explicitly disabled source maps (`sourcemap: false`). Sentry is overriding this to `true` so that errors can be un-minified in Sentry. To disable Sentry source map uploads entirely, use `sourcemaps: { disable: true }` in your Sentry options instead.', |
59 | | - ); |
60 | | - } |
61 | | - config.sourcemap = true; |
62 | | - |
63 | | - // Nitro v3 has a `sourcemapMinify` plugin that destructively deletes `sourcesContent`, |
64 | | - // `x_google_ignoreList`, and clears `mappings` for any chunk containing `node_modules`. |
65 | | - // This makes sourcemaps unusable for Sentry. |
66 | | - config.experimental = config.experimental || {}; |
67 | | - config.experimental.sourcemapMinify = false; |
68 | | - |
69 | | - if (moduleOptions?.debug) { |
70 | | - debug.log('[Sentry] Enabled source map generation and configured build settings for Sentry source map uploads.'); |
71 | | - } |
72 | | -} |
0 commit comments