【问题标题】:ES6: No source code for webpack "cheap-module-eval-source-map" and "cheap-module-source-map" only ** WEBPACK FOOTER **ES6:只有 webpack “cheap-module-eval-source-map” 和 “cheap-module-source-map” 没有源代码 ** WEBPACK FOOTER **
【发布时间】:2017-01-15 17:54:52
【问题描述】:

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

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

        debugger;
        ...

chrome (53) 中的结果是:

我尝试使用它并将配置更改为 'cheap-module-source-map''eval-source-map''source -地图'。现在只有 '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
      }]
    }
  }

【问题讨论】:

  • 那里使用的任何源地图?
  • 我已经添加了 webpack.config.js 文件。我正在使用“便宜的模块评估源地图”。我在想,也许我为该项目做了一个“npm 更新”这一事实破坏了某些东西,但我不知道它破坏了什么。
  • 好的,''eval-source-map' 似乎正在工作......
  • 我相信这只是从 Chrome 53 开始发生的。

标签: javascript webpack babeljs


【解决方案1】:

This answer 并不完全是一种修复方法——它相当于将devtool 设置覆盖为不同的(较慢的)模式。

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

【讨论】:

  • 仍然不适用于 webpack 1.14.0 和 cheap-module-eval-source-map。但是source-map 有效。我在铬。
  • 请提供一个重现问题的项目。
【解决方案2】:

尝试添加:

new webpack.EvalSourceMapDevToolPlugin()

到 webpack 配置中的 plugins 部分。

【讨论】:

    猜你喜欢
    • 2021-05-03
    • 1970-01-01
    • 2018-02-04
    • 2017-02-15
    • 2018-12-15
    • 2018-03-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多