ES6:没有webpack的源代码“cheap-module-eval-source-map”和“cheap-module-source-map”只有** WEBPACK FOOTER **

时间:2016-09-07 22:45:54

标签: javascript webpack babeljs

它曾经工作过。 现在当我添加一个断点时:

saveSnippet: (title, imageUrl, role) => {

        debugger;
        ...

chrome(53)的结果是:

breakpoint

我尝试使用它并将配置更改为'cheap-module-source-map''eval-source-map''来源-map'即可。现在只有'eval-source-map''source-map'正常工作。

webpack.config.js(Webpack 1.13.2):

  var path = require('path')
  var webpack = require('webpack')
  var CompressionPlugin = require("compression-webpack-plugin");

  module.exports = {
    debug: true,
    pathinfo:true,
    devtool: 'cheap-module-eval-source-map',
    entry: [
      'webpack-hot-middleware/client',
      './app/index'
    ],
    output: {
      path: path.join(__dirname, 'dist'),
      filename: 'bundle.js',
      publicPath: '/static/'
    },
    plugins: [
      new webpack.optimize.OccurrenceOrderPlugin(),
      new webpack.HotModuleReplacementPlugin(),
      new CompressionPlugin({
        asset: "[path].gz[query]",
        algorithm: "gzip",
        test: /\.js$|\.css$|\.html$/,
        threshold: 10240,
        minRatio: 0.8
      })

    ],
    module: {
      loaders: [{
        test: /\.js$/,
        loaders: ['babel'],
        exclude: /node_modules/,
        include: __dirname
      }]
    }
  }

2 个答案:

答案 0 :(得分:1)

尝试添加:

new webpack.EvalSourceMapDevToolPlugin()

到webpack config中的plugins部分。

答案 1 :(得分:1)

This answer并不完全是一个修复程序 - 它等同于将devtool设置覆盖到另一个(较慢)模式。

正确的修补程序已在this pull request中提交,您现在可以更新到包含它的Webpack 1.14.0。