optimize-plugin
optimize-plugin copied to clipboard
Cannot read property 'arguments' of undefined
- [email protected]
- [email protected]
- node: v15.2.0
Build completed in 78.241s
Build completed in 0s
TypeError: /Users/weiran/repo/dian/honor/assets/~containers~a~count~cash-114e7fb5.js: Cannot read property 'arguments' of undefined
at NodePath._getKey (/Users/weiran/repo/dian/honor/node_modules/optimize-plugin/node_modules/@babel/traverse/lib/path/family.js:194:25)
at NodePath.get (/Users/weiran/repo/dian/honor/node_modules/optimize-plugin/node_modules/@babel/traverse/lib/path/family.js:186:17)
at NodePath._getPattern (/Users/weiran/repo/dian/honor/node_modules/optimize-plugin/node_modules/@babel/traverse/lib/path/family.js:226:21)
at NodePath.get (/Users/weiran/repo/dian/honor/node_modules/optimize-plugin/node_modules/@babel/traverse/lib/path/family.js:188:17)
at visitParam (/Users/weiran/repo/dian/honor/node_modules/babel-preset-modernize/dist/plugins/transform-destructuring/index.js:1:5836)
at PluginPass.VariableDeclarator (/Users/weiran/repo/dian/honor/node_modules/babel-preset-modernize/dist/plugins/transform-destructuring/index.js:1:7332)
at newFn (/Users/weiran/repo/dian/honor/node_modules/optimize-plugin/node_modules/@babel/traverse/lib/visitors.js:175:21)
at NodePath._call (/Users/weiran/repo/dian/honor/node_modules/optimize-plugin/node_modules/@babel/traverse/lib/path/context.js:55:20)
at NodePath.call (/Users/weiran/repo/dian/honor/node_modules/optimize-plugin/node_modules/@babel/traverse/lib/path/context.js:42:17)
at NodePath.visit (/Users/weiran/repo/dian/honor/node_modules/optimize-plugin/node_modules/@babel/traverse/lib/path/context.js:92:31)
error Command failed with exit code 1.
Happening the same here.
- [email protected]
- [email protected]
- node: v12.16.2
Was trying to troubleshoot here but not sure where to start.
I have tried removing the preset extra configs and sourceType but no success.
module.exports = function (api) { // eslint-disable-line func-names
api.cache(true);
const presets = [
['@babel/preset-env', {
targets: {
browsers: ['last 2 versions']
},
useBuiltIns: 'usage',
corejs: '3.0.0'
}],
'@babel/react'
];
const plugins = [
'@babel/plugin-syntax-dynamic-import',
'@babel/plugin-proposal-class-properties',
'@babel/plugin-proposal-do-expressions',
'@babel/plugin-proposal-export-default-from',
'@babel/plugin-transform-runtime'
];
return {
presets,
plugins,
sourceType: 'module'
};
};
Just an update: I have a fix for this in babel-preset-modernize that should be released soon.
In the meantime, you can disable automatic modernization by passing new OptimizePlugin({ modernize: false }).
@developit, do you have a link to the PR with this fix? Thanks!