Skip to content

Commit

Permalink
ref(nextjs): Add note about upcoming default hideSourceMaps value (#…
Browse files Browse the repository at this point in the history
…5464)

This expands the explanation of the `hideSourceMaps` option in `next.config.js`, and notes that it will default to `true` starting in version 8 of the SDK.

In conjunction with getsentry/sentry-javascript#5649, getsentry/sentry-wizard#188, and vercel/next.js#40079, this is the first step in addressing the concerns raised in getsentry/sentry-javascript#4489. See getsentry/sentry-javascript#4489 (comment) for more details.
  • Loading branch information
lobsterkatie committed Aug 30, 2022
1 parent 30f4c5b commit 4bd0dd0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/platforms/javascript/guides/nextjs/manual-setup.mdx
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`:

```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

1 comment on commit 4bd0dd0

@vercel
Copy link

@vercel vercel bot commented on 4bd0dd0 Aug 30, 2022

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

sentry-docs – ./

docs.sentry.io
sentry-docs.sentry.dev
sentry-docs-git-master.sentry.dev

Please sign in to comment.