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"
}]
]
}請大拿們幫我解決困惑。問題描述問題出現的環境背景及自己嘗試過哪些方法相關代碼// 請把代碼文本粘貼到下方(請勿用圖片代替代碼)你期待的結果是什么?實際看到的錯誤信息又是什么?
- 1 回答
- 0 關注
- 871 瀏覽
添加回答
舉報
0/150
提交
取消