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"
}]
]
}
请大拿们帮我解决困惑。
问题描述
问题出现的环境背景及自己尝试过哪些方法
相关代码
// 请把代码文本粘贴到下方(请勿用图片代替代码)