webpack-dev-server: Source Map (`sockjs.js.map`) results in 404 request

  • Operating System: OSX
  • Node Version: 6.11.5
  • NPM Version: 3.10.10
  • webpack Version: 3.8.1
  • webpack-dev-server Version: 2.9.3
  • This is a bug
  • This is a feature request
  • This is a modification request

Code

  // webpack.config.js

Actual Behavior

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

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 7
  • Comments: 22 (9 by maintainers)

Most upvoted comments

I added devtool: 'inline-source-map' in webpack.config.js. It seems to work for me.

This save my day too. Thanks!

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 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.

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.

@shellscape thanks for the reply, but can you elaborate?

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.

you saved my life