// webpack.config.js
In recent releases, when using the Chrome inspector, a source map for sockjs is detected and a request is made to the server for /sockjs.js.map, which 404's on the server side. It'd be nice if the source map directive could be removed to avoid this.
//# sourceMappingURL=sockjs.js.map
We'd be happy to examine a pull request.
I believe this was introduced by #1148; certainly willing to help with a PR, but would appreciate some direction.
ping @filipesilva
Hm I see what's happening... The built lib has a //# sourceMappingURL=sockjs.min.js.map and that gets bundled as is. Then the browser tries to look it up.
To remove the source map directive (or load the sourcemap properly) the webpack config for the app would need to process this file.
This is a similar problem to the one addressed by #1148, where the a workaround was added to prevent the build configuration of webpack-dev-server to affect the client app.
I'm not sure what the 'real' solution is besides separating the builds... @shellscape I noticed that the npm version of webpack-dev-server actually seems to have bundles for stuff (client/{index,live,sockjs}.bundle.js). Are these used? It sorta feels like using them would fix this class of problems.
@filipesilva nah those client bundles are used in a totally different way. modus-manual-script, modus-inline, modus-frame examples all use the prebuilt client scripts. But the bundles for the other modes have to be built on-demand. Don't really want to go into the "why" of that, but changing that would require yet another refactor, and I'm not quite done with the refactor to get us to v3.
As a workaround, you could use the DefineWebpackPlugin to set that string; sourceMappingURL=sockjs.min.js.map to an empty string. It's a hack, but it'd probably work just fine.
I added devtool: 'inline-source-map' in webpack.config.js. It seems to work for me.
Even I tried inline-source-map , firefox console still complains, it won't show in network tab.
Source map error: request failed with status 404 Resource URL: http://localhost:8081/app.js Source Map URL: sockjs.js.map
I have tried all 7 type of source maps with mimium context (no babel, no any transformations, just pure webpack with two simple js)
chrome mentions souce maps detected, but it is never show it.
I'm getting this warning as well, any updates? I am starting a new project and I want to keep the console as clean as possible to avoid confusing junior devs.
@parkerault webpack-serve
@shellscape thanks for the reply, but can you elaborate?
having the same issue as @parkerault described, same versions of webpack and dev server. Any updates?
webpack-dev-server in maintenance mode. webpack-server (https://github.com/webpack-contrib/webpack-serve) is current stable and long term support version.
We rewrite many parts of webpack ecosystem on easy and light versions. It is fast and very stable and flexibility. Perhaps for some it seems strange why we are releasing new packages. Since the existence of webpack, we have received a lot of experience and feedback from the developers, it has allowed us to develop new approaches to solve the problems that you face. Some parts of ecosystem have problem in architecture, we can't break packages because many people still use their.
@evilebottnawi But how do I create source maps with it? My primary problem is that I need good source map support but I cannot find any info on it from webpack-serve
@marharyta source maps is part of webpack, please read https://webpack.js.org/configuration/devtool/
That is exactly what does not work for me: whenever I am including devtool (any option) it points me to client.js in browser @evilebottnawi and not to the right fule (see screenshots attached)


I added
devtool: 'inline-source-map'in webpack.config.js. It seems to work for me.
you saved my life
Somebody still has problem? if yes, please create minimum reproducible test repo, thanks!
Closing due to inactivity. Please test with latest version and feel free to reopen if still regressions. Thanks!
I've ran into this issue today, and I just wanna comment for everyone's information, that sometimes those 404 errors result from the HTML file and the dev server running on different ports. In my case, it was a Roda app running on localhost:9292 (generating HTML) and the dev server running on localhost:8080. The dev server tried to guess to connect to localhost:9292 (based on window.location), which naturally results in 404s. devServer.public is your friend here.
This save my day too. Thanks!
added devtool: 'inline-source-map' in webpack.config.js. It seems to work for me.
inline-source-map - A SourceMap is added as a DataUrl to the bundle.
Source maps are an integral tool to accurately pinpointing bugs within our source code (the files we actually write code in). Very helpful for debugging.
here is the documentation : https://webpack.js.org/configuration/devtool/
I added
devtool: 'inline-source-map'in webpack.config.js. It seems to work for me.
This worked for me as well. Be sure to restart your webpack server after updating webpack.config.js.
Most helpful comment
I added
devtool: 'inline-source-map'in webpack.config.js. It seems to work for me.