Source Maps don't work on Chrome
See original GitHub issueHello everyone, I just started to use webpack and I’m having serious issues in debugging my code. The problem is that the Chrome debugger doesn’t work properly. I’m not sure if this is a webpack issue, a Chrome issue or my fault.
This is my webpack file
var webpack = require('webpack');
module.exports = {
entry: [
'./app',
],
output: {
path: __dirname + '/assets',
publicPath: '/assets',
filename: 'app.js',
},
devServer: {
contentBase: __dirname + '/assets',
host: '0.0.0.0',
port: process.env.PORT,
historyApiFallback: true,
watchOptions: {
aggregateTimeout: 300,
poll: 1000,
}
},
cache: true,
devtool: 'inline-source-map',
plugins: [
new webpack.HotModuleReplacementPlugin(),
new webpack.DefinePlugin({
'process.env.NODE_ENV': '"development"',
}),
],
module: {
preLoaders: [
],
loaders: [
{
test: /\.js$/,
include: [ __dirname ],
exclude: /node_modules/,
loader: 'babel-loader',
},
],
},
node: {
fs: 'empty',
},
};
By changing the devtool
option I get different behaviours:
- eval: the debugger works correctly but the code is really hard to debug because I see the transpiled code
- source-map: When I set a brekpoint in a certain line, chrome often moves that breakpoint in another line. When I use the step over functionality, chrome shows me the wrong line even though the line where I stopped the execution was correct (usually the debugger moves the execution indicator where the function is declared)
- hidden-source-map: same as eval
- inline-source-map: same as source-map
- eval-source-map: The debugger adds the breakpoints on the correct line, but the execution never stops. This seems to be connected to #740
- cheap-source-map: same as eval
- cheap-module-source-map: same as source-map
I’ve tried to search both Chrome and Webpack related issues, changing browser or anything else it comes in my mind without success.
Issue Analytics
- State:
- Created 8 years ago
- Reactions:313
- Comments:226 (30 by maintainers)
Top Results From Across the Web
chrome, source map not loading - Stack Overflow
For chrome, source-map was not loading/working for me too. I kept on seeing the bundle.js files. However, in other browsers it worked, ...
Read more >The source maps don't work in Developer Tools when ...
I'm running Chrome Version 43.0.2357.124 (64-bit) on Mac OS X Yosemite 10.10.3 (14D136). I also tried this on Chrome Version 45.0.2428.0 canary ( ......
Read more >source maps are not working when debugging with chrome
Version: 6.3.1 + Platform: OSX I am debugging my mocha tests using native node debugger, using the following command: /usr/local/bin/node ...
Read more >sourcemaps are detected but not working in chrome-extension ...
"sourcemaps are detected" message is shown in the sources tab but the original source files are not listed. if the page is loaded...
Read more >SourceMaps | Down and Dirty with Chrome Developer Tools
Enable sourcemaps in the developer tool settings. Close and reload the developer tools. Open up ctrl + O example.ts and example.coffee . Explore...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I just conducted a little experiment, which might be of interest here.
Chrome 57, webpack 2.3.3, babel-core 6.24.1, babel-loader 6.4.1, vue-loader 11.3.4
Notes:
foo.js?a1b2:123
). In this case Chrome cannot map the file to the filesystem so it cannot be edited in the Developer Tools. Note: Currently, when I set up a mapping, I can no longer use breakpoints, I haven’t found out the reason yet.1 Breakpoints cannot be set properly, but set breakpoints do trigger. 2 Of course the source only shows after the file has been mapped, but then line number and file name are shown correctly. 🔺 The
inline-source-map
andcheap-module-inline-source-map
styles are not listed in this table.I have this issue on OSX. Also, https://phabricator.babeljs.io/T6842