Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
```javascript
module.exports = {
output: {
// Make maps auto-detectable by sentry-cli
filename: "[name].js",
sourceMapFilename: "[name].js.map",
// Other `output` configuration
},
// Other configuration
};
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
```javascript {filename:next.config.js}
const { withSentryConfig } = require("@sentry/nextjs");

const moduleExports = {
webpack: (config, options) => {
devtool = 'source-map',
config.output = {
...config.output,
// Make maps auto-detectable by sentry-cli
filename: "[name].js",
sourceMapFilename: "[name].js.map",
};
return config;
},
productionBrowserSourceMaps: true,
// Other nextjs configuration
};

const SentryWebpackPluginOptions = {
// Additional config options for the Sentry Webpack plugin.
};

module.exports = withSentryConfig(moduleExports, SentryWebpackPluginOptions);
```

Learn more about the Webpack usage for the Next.js SDK in [Extend Default Webpack Usage](/platforms/javascript/guides/nextjs/manual-setup/#extend-default-webpack-usage).
11 changes: 1 addition & 10 deletions src/platforms/javascript/common/sourcemaps/tools/webpack.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -77,16 +77,7 @@ Set up the `SentryWebpackPlugin` as the last running plugin, otherwise, the resu

If you prefer to upload source maps manually, configure Webpack to output source maps:

```javascript
module.exports = {
output: {
path: path.join(__dirname, "dist"),
filename: "[name].js",
sourceMapFilename: "[name].js.map",
},
// other configuration
};
```
<PlatformContent includePath="configuration/sourcemaps/tools/webpack/advanced-usage" />

If you use [SourceMapDevToolPlugin](https://webpack.js.org/plugins/source-map-dev-tool-plugin) for more fine-grained control of source map generation, turn off `noSources` so Sentry can display proper source code context in event stack traces.

Expand Down