在webpack.prod.config.js中修改为如下:
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false,
drop_debugger: true,
drop_console: true
},
sourceMap: true
}),
在生产环境下, 因为代码都被编译压缩成一行了, 所以报错都在一行
webpack.config.js:
var path = require('path');
module.exports = {
devtool: 'source-map', // 添加此行
mode: 'development',
entry: './client/index.js',
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, 'client')
}
}