Files
next.js/test/integration/config-devtool-dev/next.config.js
T
Sebastian "Sebbie" SilbermannandGitHub 0105f6bf77 Populate sourcemap ignoreList when Webpack is used (#71821)
This enables DevTools (e.g. Chrome debugger) to collapse stackframes from 3rd party dependencies.

Webpack only. Turbopack added support in https://github.com/vercel/next.js/pull/71770. Replays from RSC will follow.



Had to fork `EvalSourceMapDevToolPlugin` (with blessing from @sokra) to be able to inject `ignoreList`. 

For `source-map`, we can use https://github.com/mondaychen/devtools-ignore-webpack-plugin/ instead since we can operate on the assets on disk. I inlined it to iterate on it faster. Though it'd be faster for bundling to also fork `SourceMapDevToolPlugin` since `DevToolsIgnorePlugin` adds another parse/serialize roundtrip.

## test plan

We'll start leveraging `ignoreList` in the terminal as well which will allow us to write automated tests. I haven't found a way to automatically test this ignore-listing in browsers.

Note that this is on Chrome Beta. Chrome Stable does not ignore-list logged stacks yet. Only stacks of the actual `console` call or in the debugger.
(the frame from our console instrumentation is a bug that may be fixed once we populate our own sourcemaps)
`pnpm debug dev test/e2e/app-dir/server-source-maps/fixtures/default/`
`/ssr-error-log` shows
browser:
![CleanShot 2024-10-24 at 20 37 43](https://github.com/user-attachments/assets/fec14ec7-4c2c-4ce3-8454-1e43a0c8d0a7)
![CleanShot 2024-10-24 at 20 37 52](https://github.com/user-attachments/assets/53a233be-448e-4110-93c5-b5c4f6f98b6b)

Node.js debugger doesn't seem to work. Will look at that in a follow-up
2024-10-29 00:56:44 +01:00

7 lines
116 B
JavaScript

module.exports = {
webpack: (config) => {
config.devtool = 'cheap-module-source-map'
return config
},
}