Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(nextjs): Do not hide sourceMappingURL comment on client when nextConfig.productionBrowserSourceMaps: true is set #12278

Merged
merged 1 commit into from
May 29, 2024
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
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
Loading