|
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, |
@@ -42,33 +42,10 @@ export function setupSentryNitroModule( |
42 | 42 | config.tracing = true; |
43 | 43 | } |
44 | 44 |
|
45 | | - const sourcemapUploadDisabled = moduleOptions?.sourcemaps?.disable === true || moduleOptions?.disable === true; |
46 | | - |
47 | | - if (!sourcemapUploadDisabled) { |
48 | | - configureSourcemapSettings(config, moduleOptions); |
49 | | - } |
| 45 | + configureSourcemapSettings(config, moduleOptions); |
50 | 46 |
|
51 | 47 | config.modules = config.modules || []; |
52 | 48 | config.modules.push(createNitroModule(moduleOptions)); |
53 | 49 |
|
54 | 50 | return config; |
55 | 51 | } |
56 | | - |
57 | | -function configureSourcemapSettings(config: NitroConfig, moduleOptions?: SentryNitroOptions): void { |
58 | | - if (config.sourcemap === false) { |
59 | | - debug.warn( |
60 | | - '[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.', |
61 | | - ); |
62 | | - } |
63 | | - config.sourcemap = true; |
64 | | - |
65 | | - // Nitro v3 has a `sourcemapMinify` plugin that destructively deletes `sourcesContent`, |
66 | | - // `x_google_ignoreList`, and clears `mappings` for any chunk containing `node_modules`. |
67 | | - // This makes sourcemaps unusable for Sentry. |
68 | | - config.experimental = config.experimental || {}; |
69 | | - config.experimental.sourcemapMinify = false; |
70 | | - |
71 | | - if (moduleOptions?.debug) { |
72 | | - debug.log('[Sentry] Enabled source map generation and configured build settings for Sentry source map uploads.'); |
73 | | - } |
74 | | -} |
0 commit comments