Search code examples
javascriptnode.jsbrowserifywebpackwebpack-dev-server

how do I add debug to my webpack config


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' }
    ]
  }
};

Solution

  • Looks like I just needed to add source mapping: 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' }
        ]
      }
    };