我已将create-react-app从1升级到2,并且我的其中一个插件随后停止工作,因为module
exports
似乎存在问题
我已经使用新版本的babel7
和webpack4
升级了配置
模块失败并出现以下问题-
TypeError: Cannot set property 'x' of undefined
(function (exports) {
exports.x = x;
...
这是我的babel配置-
"babel": {
"plugins": [
"add-module-exports",
"@babel/plugin-syntax-dynamic-import",
[
"@babel/plugin-proposal-decorators",
{
"legacy": true
}
],
[
"@babel/plugin-proposal-class-properties",
{
"loose": false
}
]
],
"presets": [
[
"@babel/preset-env",
{
"modules": false
}
],
[
"react-app",
{
"helpers": false,
"absoluteRuntime": false
}
]
]
}
这是我的webpack配置-
https://gist.github.com/sandipp/282bbbc1d23e6e9c2d8e2b01dc1077d7