Skip to content

Commit

Permalink
fix(nextjs): Do not hide sourceMappingURL comment on client when `n…
Browse files Browse the repository at this point in the history
…extConfig.productionBrowserSourceMaps: true` is set (#12278)
  • Loading branch information
lforst authored May 29, 2024
1 parent 0d1093d commit d9562b9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/nextjs/src/config/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export type NextConfigObject = {
instrumentationHook?: boolean;
clientTraceMetadata?: string[];
};
productionBrowserSourceMaps?: boolean;
};

export type SentryBuildOptions = {
Expand Down
3 changes: 2 additions & 1 deletion packages/nextjs/src/config/webpack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,8 @@ export function constructWebpackConfigFunction(
// the browser won't look for them and throw errors into the console when it can't find them. Because this is a
// front-end-only problem, and because `sentry-cli` handles sourcemaps more reliably with the comment than
// without, the option to use `hidden-source-map` only applies to the client-side build.
newConfig.devtool = !isServer ? 'hidden-source-map' : 'source-map';
newConfig.devtool =
isServer || userNextConfig.productionBrowserSourceMaps ? 'source-map' : 'hidden-source-map';
}

newConfig.plugins = newConfig.plugins || [];
Expand Down

0 comments on commit d9562b9

Please sign in to comment.