Skip to content

ref(nextjs): Add note about upcoming default hideSourceMaps value #5464

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 1 commit into from
Aug 30, 2022
Merged
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
6 changes: 3 additions & 3 deletions src/platforms/javascript/guides/nextjs/manual-setup.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,9 @@ In that case you can also skip the `sentry-cli` configuration step below.

### Use `hidden-source-map`

_(New in version 6.17.1)_
_(New in version 6.17.1, will default to `true` in 8.0.0 and beyond.)_

If you would like to use `hidden-source-map` rather than `source-map` as your webpack `devtool`, so that your built files do not contain a `sourceMappingURL` comment, add a `sentry` object to `moduleExports` above, and set the `hideSourceMaps` option to `true`:
Depending on your deployment setup, adding `sentry/nextjs` to your app may cause your source code to be visible in browser devtools when it wasn't before. (This happens because of the default behavior of [Webpack's `source-map` built-in `devtool`](https://webpack.js.org/configuration/devtool/).) To prevent this, you can use `hidden-source-map` rather than `source-map`, which will prevent your built files from containing a `sourceMappingURL` comment, thus making sourcemaps invisible to the browser. To use `hidden-source-map`, add a `sentry` object to `moduleExports` above, and set the `hideSourceMaps` option to `true`:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The way you've used the word "above" in that last sentence is a bit confusing. At first I thought I needed to refer to code snippet previous to this one. If you said "above it" instead, would that work?

Copy link
Member Author

@lobsterkatie lobsterkatie Aug 30, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, because there's no real antecedent for "it" there, but I can reword to make it clearer.

That said, my preference would be to make the change in a separate PR, for a few reasons:
a) You weren't wrong - it is in fact referring to the code snippet in https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/#extend-nextjs-configuration, which is where moduleExports is originally defined.
b) That wording isn't new in this PR.
c) The same wording is used in the sections above and below the one I'm changing here, so if I fix it here, I should fix it there, too, which broadens the scope of this PR past what it really should be.


```javascript {filename:next.config.js}
const moduleExports = {
Expand All @@ -256,7 +256,7 @@ const moduleExports = {
};
```

Note that this only applies to client-side builds, and requires the `SentryWebpackPlugin` to be enabled.
Note that this only applies to client-side builds, and requires the `SentryWebpackPlugin` to be enabled. This option will default to `true` starting in version 8.0.0. See https://webpack.js.org/configuration/devtool/ for more information.

### Widen the Upload Scope

Expand Down