webpack + babel加载器源映射引用空文件 [英] webpack + babel loader source map references empty file

查看:113
本文介绍了webpack + babel加载器源映射引用空文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用Webpack + babel loader捆绑在一起的es6项目. 当我打开devtools时,可以在下面看到"webpack://"及其所有源代码(es6).

I have an es6 project which I bundle using webpack + babel loader. When I open the devtools I can see 'webpack://' and all my sources (es6) underneath.

问题是:断点没有命中,函数引用将我定向到文件名'?d41d

The problems are: breakpoints don't hit and function references directs me to a file name '?d41d

具有以下内容:

undefined


/** WEBPACK FOOTER **
 ** 
 **/

如果我从文档脚本中向下钻取到捆绑软件中的某个函数,我也将找到?d41d文件

if I drill down from document script to a function in my bundle I get to the ?d41d file as well

我的webpack.config.js:

my webpack.config.js:

module.exports = {

    debug: true,
    devtool: 'cheap-module-eval-source-map',
    entry: "entry.js",
    output: {
        path: "C:/html5/",
        filename: "bundle.js"
    },
    module: {
        loaders: [
            {
                test: /\.js$/,
                exclude: /(node_modules|bower_components)/,
                loader: 'babel',
                query: {
                    presets: ['es2015'],
                    plugins: ['transform-object-assign'],
                    sourceMaps: ['inline']
                }
            }
        ]
    }
};

和package.json的一部分,以防万一:

and part of package.json in case it might help:

"devDependencies": {
    "ava": "^0.16.0",
    "babel-core": "^6.14.0",
    "babel-loader": "^6.2.5",
    "babel-plugin-transform-object-assign": "^6.8.0",
    "babel-preset-es2015": "^6.13.2",
    "cheerio": "^0.22.0",
    "chokidar-cli": "^1.2.0",
    "eslint": "^3.3.1",
    "html-to-js": "0.0.1",
    "jsdoc": "^3.4.0",
    "jsdom": "^9.4.2",
    "minami": "^1.1.1",
    "obfuscator": "^0.5.4",
    "sinon": "^1.17.5",
    "uglify-js": "^2.7.3",
    "webpack": "^1.13.2",
    "yargs": "^5.0.0"
  },
  "dependencies": {
    "jquery": "^3.1.0"
  }

谢谢.

推荐答案

Babel引入了不同的源地图格式此处,并且Webpack无法正确处理它.
该修补程序已合并到此PR 中,并在 Webpack 1.14.0 .

Babel introduced a different sourcemap format here and Webpack didn't handle it correctly.
The fix was merged in this PR, and released in Webpack 1.14.0.

这篇关于webpack + babel加载器源映射引用空文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆