I am creating a Webpack build process for an existing project and run into some problems with the source maps.
I am using devtool: 'eval-source-map', If an error occurs in the browser, each file / line number in the stack trace indicates a file compressed into one line in the Webpack package.
For example, the first line of a stack trace might look like this:
Unprepared error: foo
at child.initialize (eval at ( http://127.0.0.1:8000/js/dist/index.js:1270:1 ) ,: 45: 10)
Clicking on the file name / line number brings me to the set to the line where the file in which the error occurred gets "in the set" using Webpack. Looks like that:
(function(module, exports, __webpack_require__) { "use strict";
However, the entire contents of the file are in this single line, so it is completely useless.
This happens even if I trim the Webpack configuration before this:
var path = require('path'), webpack = require('webpack'); module.exports = { entry: { 'indexhead': './static/js/main.js', 'accounthead': './static/js/accountManager.js' }, output: { path: path.join(__dirname, 'static/js/dist'), filename: '[name].js' }, devtool: 'eval-source-map', };
And it happens for the other types of types of development source maps indicated here . If instead I use the production setting devtool: source-map , I will still point to a giant package file with every single script there, but at least the lines are “deployed” and I see where the error occurred.
How can I fix this or at least fix the malfunction?