Skip to content

feat(nextjs): Document hideSourceMaps option #4627

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

Merged
merged 2 commits into from
Jan 24, 2022

Conversation

lobsterkatie
Copy link
Member

This documents the option added in getsentry/sentry-javascript#4436, to allow users to use hidden-source-map as their webpack devtool for client-side builds. (With this option enabled, the same sourcemaps are generated, but the final bundles don't have a sourceMappingURL comment, effectively "hiding" the sourcemaps from the browser. Doing this prevents the browser from complaining in situations where the maps are not publicly hosted.)

@vercel
Copy link

vercel bot commented Jan 21, 2022

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/sentry/sentry-docs/29m5u5r4EnVYbM1V3NjjdcWxtJ7Q
✅ Preview: https://sentry-docs-git-kmclb-nextjs-document-hidesourcemaps-option.sentry.dev

lobsterkatie added a commit to getsentry/sentry-javascript that referenced this pull request Jan 24, 2022
…ol` value (#4436)

We currently force the value of the webpack option `devtool` to be `source-map`, in order to guarantee that the correct sourcemaps are generated during build. There is another `devtool` value[1], `hidden-source-map`, which produces the same maps (so just as good for our purposes), but without adding `sourceMappingURL` comments at the bottom of the resulting JS files. (Some users prefer this as a way not to have the browser complain when it tries to follow the `sourceMappingURL` link and comes up empty.)

This PR adds an option that users can pass in their nextjs config, under the key `sentry.hideSourceMaps`. When this is set to true, the SDK will use `hidden-source-map` as the `devtool` value instead of `source-map`. Note that since this is a front-end-only problem, the option only applies to client-side builds.

The new option is documented in getsentry/sentry-docs#4627.

Fixes #3549.

[1] https://webpack.js.org/configuration/devtool/
Co-authored-by: Abhijeet Prasad <[email protected]>
@lobsterkatie lobsterkatie merged commit b1d73b6 into master Jan 24, 2022
@lobsterkatie lobsterkatie deleted the kmclb-nextjs-document-hideSourceMaps-option branch January 24, 2022 16:54
@github-actions github-actions bot locked and limited conversation to collaborators Feb 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants