3

I have moved one of my projects from browserify over to webpack, and I was just wondering how I add debug to the config file, similar to browserify --debug to give source mapping.

Here is my webpack.config file:

module.exports = {
  entry: './src/js/main.js',
  output: {
    filename: 'bundle.js',
    path: './src/public/',
    publicPath: 'public'
  },
  module: {
    loaders: [
      { test: /\.js$/, loader: 'babel-loader' }
    ]
  }
};
4

2 回答 2

3

看起来我只需要添加源映射:devtool: 'source-map'

module.exports = {
  devtool: 'source-map',
  entry: './src/js/main.js',
  output: {
    filename: 'bundle.js',
    path: './src/public/',
    publicPath: 'public'
  },
  module: {
    loaders: [
      { test: /\.js$/, loader: 'babel-loader' }
    ]
  }
};
于 2015-10-27T11:06:57.320 回答
0

如果您使用的是webpack 版本 4+ 请在您的webpack.config.js

供参考:https ://webpack.js.org/configuration/devtool/

于 2020-05-05T10:34:50.040 回答