1
+ // This file sets a custom webpack configuration to use your Next.js app
2
+ // with Sentry.
3
+ // https://nextjs.org/docs/api-reference/next.config.js/introduction
4
+ // https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/
5
+ const { withSentryConfig } = require ( '@sentry/nextjs' )
6
+
1
7
/** @type {import('next').NextConfig } */
2
8
const nextConfig = {
3
9
output : 'standalone' ,
@@ -8,4 +14,42 @@ const nextConfig = {
8
14
} ,
9
15
}
10
16
11
- module . exports = nextConfig
17
+ const moduleExports = {
18
+ nextConfig,
19
+ sentry : {
20
+ // Use `hidden-source-map` rather than `source-map` as the Webpack `devtool`
21
+ // for client-side builds. (This will be the default starting in
22
+ // `@sentry/nextjs` version 8.0.0.) See
23
+ // https://webpack.js.org/configuration/devtool/ and
24
+ // https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/#use-hidden-source-map
25
+ // for more information.
26
+ hideSourceMaps : true ,
27
+ } ,
28
+ }
29
+
30
+ const sentryWebpackPluginOptions = {
31
+ // Additional config options for the Sentry Webpack plugin. Keep in mind that
32
+ // the following options are set automatically, and overriding them is not
33
+ // recommended:
34
+ // release, url, org, project, authToken, configFile, stripPrefix,
35
+ // urlPrefix, include, ignore
36
+
37
+ silent : true , // Suppresses all logs
38
+ // For all available options, see:
39
+ // https://github.com/getsentry/sentry-webpack-plugin#options.
40
+ }
41
+
42
+
43
+ // module.exports = withSentryConfig(
44
+ // module.exports,
45
+ // nextConfig,
46
+ // { silent: true },
47
+ // { hideSourceMaps: true },
48
+ // )
49
+
50
+ // Make sure adding Sentry options is the last code to run before exporting, to
51
+ // ensure that your source maps include changes from all other Webpack plugins
52
+ module . exports = withSentryConfig (
53
+ moduleExports ,
54
+ sentryWebpackPluginOptions
55
+ )
0 commit comments