You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
doesn't handle webpack:/// urls well, is there a way to map webpack:/// to a path? #278
I run the backend using the nodemon plugin, and passed it the enable-source-map flag so that nodejs reads the generated webpack maps. Now stacktrace will be displayed correctly, but it will contain the webpack:/// path.
To avoid this, I changed the output part of the configuration webpack.config.js
By creating a Callback function in the parameter devtoolModuleFilenameTemplate, and I return a string like files:///full/path/to/file I am using nodejs 16 lts so --enable-source-map works well, this flag appeared in node js 12
Surprisingly, now stack trace and debug (in vs code) work fine, with a path that does not contain webpack:///
Now I don't need node-source-map-support plugin, and I can completely abandon its use, leaving only node js native source map.
Activity
braddialpad commentedon Aug 3, 2021
I am having this exact problem as well, have tried a million things, no luck yet.
WeslyG commentedon Nov 8, 2021
Hi, 15 people is a lot for this task to remain unsolved, so I decided to dig deeper.
The first thing I did was set the
--enable-source-mapsflag when running the compiled js file.the problem with
webpack:///persistedI found a wonderful guide on the web, by sourcemap in nodejs, which dealt with most of the problems.
https://www.freecodecamp.org/news/how-to-solve-webpack-problems-the-practical-case-79fb676417f4/
In the end, I solved this for myself with the following configuration in webpack
I run the backend using the nodemon plugin, and passed it the enable-source-map flag so that nodejs reads the generated webpack maps. Now stacktrace will be displayed correctly, but it will contain the
webpack:///path.To avoid this, I changed the output part of the configuration webpack.config.js
By creating a Callback function in the parameter
devtoolModuleFilenameTemplate, and I return a string likefiles:///full/path/to/fileI am using nodejs 16 lts so--enable-source-mapworks well, this flag appeared in node js 12Surprisingly, now stack trace and debug (in vs code) work fine, with a path that does not contain
webpack:///Now I don't need
node-source-map-supportplugin, and I can completely abandon its use, leaving only node js native source map.