Skip to content

Commit b1d73b6

Browse files
authored
feat(nextjs): Document hideSourceMaps option (#4627)
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.)
1 parent 49a5af4 commit b1d73b6

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/platforms/javascript/guides/nextjs/manual-setup.mdx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,8 @@ By default, `withSentryConfig` will add an instance of `SentryWebpackPlugin` to
194194

195195
To configure the plugin, pass a `sentryWebpackPluginOptions` argument to `withSentryConfig`, as seen in the example above. All available options are documented [here](https://github.com/getsentry/sentry-webpack-plugin#options).
196196

197+
### Disable `SentryWebpackPlugin`
198+
197199
If you want or need to handle source map uploading separately, the plugin can be disabled for either the server or client build process. To do this, add a `sentry` object to `moduleExports` above, and set the relevant options there:
198200

199201
```javascript {filename:next.config.js}
@@ -213,6 +215,23 @@ module.exports = withSentryConfig(moduleExports);
213215

214216
In that case you can also skip the `sentry-cli` configuration step below.
215217

218+
### Use `hidden-source-map`
219+
220+
221+
_(New in version 6.17.1)_
222+
223+
If you would like to use `hidden-source-map` rather than `souce-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`:
224+
225+
```javascript {filename:next.config.js}
226+
const moduleExports = {
227+
sentry: {
228+
hideSourceMaps: true,
229+
},
230+
};
231+
```
232+
233+
Note that this only applies to client-side builds.
234+
216235
## Configure `sentry-cli`
217236

218237
The `SentryWebpackPlugin` uses `sentry-cli` to manage releases and source maps, which can be configured in one of two ways - using configuration files, or with environment variables - both of which are discussed below. For full details, see [the CLI configuration docs](/product/cli/configuration/).

0 commit comments

Comments
 (0)