在chrome中检测到源映射,但未使用webpack-2加载原始源

问题描述 投票:20回答:2

运行使用webpack 2构建的应用程序时,会在chrome中检测到源映射,但未加载原始源。我正在使用webpack beta21。

这些文件曾经被自动检测到,即当断点被放入webpack js文件的输出中时,源视图将跳转到webpack的原始源输入。但现在我被困在这个屏幕上:enter image description here

配置:

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()
  ]

};
google-chrome webpack source-maps webpack-2
2个回答
1
投票

外部源地图的问题已在Chrome 52中得到修复,但看起来你的devtool设置与我的不同,我使用:

devtool: '#source-maps'

你是如何建立你的来源的?如果您使用-d运行,它将切换到内联源映射


0
投票

如果您要映射到工作区,则表示您已拥有源代码。在源映射中包含源代码会产生不必要的冗余。

请改用nosources-source-map

© www.soinside.com 2019 - 2024. All rights reserved.