in webpack.config.js:
- set debug flag to true
- specify devtool
like this:
module.exports = { entry: "./index.js", //"./tryfirst/tree.js", // output: { path: __dirname, filename: "bundle.js" }, debug: true, devtool: 'cheap-module-eval-source-map', module: { loaders: [ ...
If you are used to running babel from the command line, you can set the same parameters on the command line as follows:
babel src -d lib --presets es2015 --sourceMaps inline; webpack --devtool eval-source-map
The same line can be added to package.json as a script. Just add something like this to the scripts section:
"scripts": { ..., "test": "babel src -d lib --presets es2015 --sourceMaps inline; webpack --devtool eval-source-map" },
Then you can easily start it from the command line, not having in mind all the parameters and flags:
npm run test
The code inside the scripts works exactly (for the most part, at least), like what you type on the console. npm run test (or what you call a script) is a shortcut that you can use from now on.
If it does not stop at breakpoints, try adding the "debugger" command; at the desired breakpoint in your actual javascript code. It looks funny, but usually does the trick. Chrome will find them and set breakpoints there.
source share