webpack: web pack source map not working for some devtool options.

Do you want to request a feature or report a bug? bug

What is the current behavior? Sourcemap is not working for some devtool options. Tested options: eval: working cheap-eval-source-map: working cheap-source-map: not working cheap-module-eval-source-map: working cheap-module-source-map: not working source-map: not working inline-source-map: not working hidden-source-map: not working nosources-source-map: not working

If the current behavior is a bug, please provide the steps to reproduce.

I reproduced the bug in this repo: https://github.com/SemihGk/waka-player npm install -> npm run prod -> watch console messages in localhost:3000

It’s really a weird issue. I am not sure any plugin causes this error. I do not think so. Just in case, you may check that in the repo. It is very basic sample repo and just used a couple webpack plugins such as html-webpack-plugin and copy-webpack-plugin. You can find those plugins’ versions in package.json file. I suspect the compatibility between webpack and babel-loader.

What is the expected behavior? source map should work in all devtool options.

If this is a feature request, what is motivation or use case for changing the behavior? It’s bug.

Please mention other relevant information such as the browser version, Node.js version, webpack version and Operating System.

“webpack”: “^3.5.1”, Mac OS: 10.12.6 node: 8.2.1 Tested on Chrome 60, Mozilla 54, Safari 10.1

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 42
  • Comments: 28 (1 by maintainers)

Commits related to this issue

Most upvoted comments

Same thing here, can’t get any sourcemaps other than *-eval-* sourcemaps to work 😡

For some reason, not sure why, we’ve run into this bug too, will migrating to Webpack 4 fix this ?

But our SCSS sourcemaps generated by gulp-sourcemaps are working fine, which makes me think this isn’t a Chrome issue

Update: Do make sure they’re not disabled in Chrome 🤦‍♂️
screen shot 2018-06-27 at 17 03 01

Hi is there a workaround for this? For me devtool: 'inline-source-map' works but devtool: 'source-map' does not. It produces an nearly empty source map.

@SemihGk I had a similar issue and was able to resolve this by reading through https://github.com/webpack/webpack/issues/5569#issuecomment-325262489 and changing the -d (dev flag) to -p

  "scripts": {
    "start": "node ./node_modules/webpack-dev-server/bin/webpack-dev-server.js -p",
    "clean-js": "rm -rf ./dist/js",
    "quality": "eslint",
    "build": "webpack",
    "build-prod": "webpack --config webpack-production.config.js -p",
    "test": "node scripts/test.js --env=jsdom"
  },

I tested your project. It seemed no bug. Browser: Chrome version: 59.0.3071.86 Operating system: windows 7 64bit image

You could test this way with other sourcemap types to see if it works the same. The test with the configuration devtool: 'source-map' suggests that it has nothing to do with webpack.

Source maps are used for debugging. The behavior of Chrome is reasonable .

If the script is within an iframe, you have to enable “Search in anonymous and content scripts” in Chrome.

@devssh so you get sourcemaps even with devtool: "source-map", or what? Can you post your webpack config?

Hey @yincu . It is already marked as an important bug. You cannot expect them to fix the bug right away as there are tons of bugs are on their list.

As I described in my first message, watch console.logs carefully. Otherwise, sourcemaps files are already created.

I just cloned my repo and did run it again. It is still a clear bug as you may see in the screenshot. Expecting behavior is that show the exact file and line. Not the bundled file. How about your console?

screen shot 2017-08-29 at 10 04 59 pm

I’ve explored this further and my sourcemaps are working as expected in Firefox. Just not in Chrome.