You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(nitro): Respect user's explicit sourcemap setting instead of forcing true
Previously, `configureSourcemapSettings` unconditionally set
`config.sourcemap = true`, overriding the user's explicit `false`. This
could expose source maps publicly when users intentionally disabled them.
Now follows the same 3-case pattern as other meta-framework SDKs (Nuxt):
1. User disabled (false) → keep their setting, warn about unminified errors
2. User enabled (true) → keep their setting
3. User didn't set (undefined) → enable for Sentry
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@@ -101,20 +108,26 @@ export function configureSourcemapSettings(config: NitroConfig, moduleOptions?:
101
108
102
109
if(config.sourcemap===false){
103
110
debug.warn(
104
-
'[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.',
111
+
'[Sentry] You have explicitly disabled source maps (`sourcemap: false`). Sentry will not upload source maps, and errors will not be unminified. To let Sentry handle source maps, remove the `sourcemap` option from your Nitro config, or use `sourcemaps: { disable: true }` in your Sentry options to silence this warning.',
105
112
);
113
+
return;
106
114
}
107
115
108
-
config.sourcemap=true;
116
+
if(config.sourcemap===true){
117
+
if(moduleOptions?.debug){
118
+
debug.log('[Sentry] Source maps are already enabled. Sentry will upload them for error unminification.');
119
+
}
120
+
}else{
121
+
// User did not explicitly set sourcemap — enable it for Sentry
122
+
config.sourcemap=true;
123
+
if(moduleOptions?.debug){
124
+
debug.log('[Sentry] Enabled source map generation for Sentry. Source map files will be deleted after upload.');
125
+
}
126
+
}
109
127
110
128
// Nitro v3 has a `sourcemapMinify` plugin that destructively deletes `sourcesContent`,
111
129
// `x_google_ignoreList`, and clears `mappings` for any chunk containing `node_modules`.
112
130
// This makes sourcemaps unusable for Sentry.
113
-
// FIXME: Not sure about this one, it works either way?
114
131
config.experimental=config.experimental||{};
115
132
config.experimental.sourcemapMinify=false;
116
-
117
-
if(moduleOptions?.debug){
118
-
debug.log('[Sentry] Enabled source map generation and configured build settings for Sentry source map uploads.');
0 commit comments