react多入口:
webpack 提取公共模块,编译可以通过,但是执行JS报错:"Uncaught ReferenceError: exports is not defined"
看编译后的文件跟正常编译后的文件有很大的差别:例如
exports.ids = [6];
exports.modules = {/***/ 100:/***/ (function(module, exports) {module.exports = function (it, Constructor, name, forbiddenField) { if (!(it instanceof Constructor) || (forbiddenField !== undefined && forbiddenField in it)) { throw TypeError(name + ': incorrect invocation!');
} return it;
};错误也就是定位到第一行。
这里是跟babel配置有关系么?配置代码如下:
{ "presets": [
["es2015", {
// "modules": false
}], "stage-2", "react"
], "plugins": [ "transform-decorators-legacy", "react-hot-loader/babel", ["transform-runtime", { "helpers": false, "polyfill": true, "regenerator": true, "moduleName": "babel-runtime"
}]
]
}请大拿们帮我解决困惑。
// 请把代码文本粘贴到下方(请勿用图片代替代码)
莫回无
BIG阳
随时随地看视频慕课网APP
相关分类