运行使用webpack 2构建的应用程序时,会在chrome中检测到源映射,但未加载原始源。我正在使用webpack beta21。
这些文件曾经被自动检测到,即当断点被放入webpack js文件的输出中时,源视图将跳转到webpack的原始源输入。但现在我被困在这个屏幕上:
配置:
var path = require("path");
var webpack = require("webpack");
var WebpackBuildNotifierPlugin = require('webpack-build-notifier');
const PATHS = {
app: path.join(__dirname, '../client'),
build: path.join(__dirname, '../public')
};
module.exports = {
entry: {
app: PATHS.app + '/app.js'
},
output: {
path: PATHS.build,
filename: '[name].js'
},
devtool: "source-map",
module: {
loaders: [
{
test: /\.js?$/,
loader: 'babel-loader',
include: [
path.resolve(__dirname, 'client'),
],
exclude: /node_modules/
},
{
test: /\.css/,
loader: "style!css"
}
]
},
resolve: {
// you can now require('file') instead of require('file.js')
extensions: ['', '.js', '.json']
} ,
plugins: [
new WebpackBuildNotifierPlugin()
]
};
外部源地图的问题已在Chrome 52中得到修复,但看起来你的devtool设置与我的不同,我使用:
devtool: '#source-maps'
你是如何建立你的来源的?如果您使用-d
运行,它将切换到内联源映射
如果您要映射到工作区,则表示您已拥有源代码。在源映射中包含源代码会产生不必要的冗余。
请改用nosources-source-map
。