通过Debug = true在React + Webpack中隐藏的bundle.js错误在webpack.config.js

时间:2016-07-15 09:05:04

标签: javascript reactjs webpack

出于调试目的,我想获得产生错误的行号,但我得到了这个:

error message react

它引用了bundle.js虽然我在 webpack.config.js 中指定了debug = true:

var path = require('path')
var webpack = require('webpack')

module.exports = {
  debug: true,
  devtool: 'cheap-module-eval-source-map',
  entry: [
    'webpack-hot-middleware/client',
    './index'
  ],
  output: {
    path: path.join(__dirname, 'dist'),
    filename: 'bundle.js',
    publicPath: '/static/'
  },
  plugins: [
    new webpack.optimize.OccurrenceOrderPlugin(),
    new webpack.HotModuleReplacementPlugin()
  ],
  module: {
    loaders: [{
      test: /\.js$/,
      loaders: ['babel'],
      exclude: /node_modules/,
      include: __dirname
    }]
  }
}

无论如何,我可以在预编译的js中获得行号吗?

我尝试添加pathInfo作为this回答推荐,但无济于事。

0 个答案:

没有答案