babel-plugin-extensible-destructuring icon indicating copy to clipboard operation
babel-plugin-extensible-destructuring copied to clipboard

Cannot read property 'name' of undefined

Open wataru358 opened this issue 7 years ago • 6 comments

Hi, Using 4.2.0 with [email protected] gave us following issue on our webpack build. Noticed when I do clean npm install yesterday. Using 4.1.0 won't cause any issue. Any insight on this...?

webpack build error ` ERROR in ./src/utils/xxxx.js Module build failed: TypeError: /Users/myuser/myproject/src/utils/myreactcomponent.js: Cannot read property 'name' of undefined at DestructuringTransformer.pushObjectProperty (/Users/myuser/myproject/node_modules/babel-plugin-extensible-destructuring/lib/index.js:209:96) at DestructuringTransformer.pushObjectPattern (/Users/myuser/myproject/node_modules/babel-plugin-extensible-destructuring/lib/index.js:251:18) at DestructuringTransformer.push (/Users/myuser/myproject/node_modules/babel-plugin-extensible-destructuring/lib/index.js:156:16) at DestructuringTransformer.init (/Users/myuser/myproject/node_modules/babel-plugin-extensible-destructuring/lib/index.js:417:14) at PluginPass.VariableDeclaration (/Users/myuser/myproject/node_modules/babel-plugin-extensible-destructuring/lib/index.js:639:27) at newFn (/Users/myuser/myproject/node_modules/babel-traverse/lib/visitors.js:276:21) at NodePath._call (/Users/myuser/myproject/node_modules/babel-traverse/lib/path/context.js:76:18) at NodePath.call (/Users/myuser/myproject/node_modules/babel-traverse/lib/path/context.js:48:17) at NodePath.visit (/Users/myuser/myproject/node_modules/babel-traverse/lib/path/context.js:105:12) at TraversalContext.visitQueue (/Users/myuser/myproject/node_modules/babel-traverse/lib/context.js:150:16) at TraversalContext.visitMultiple (/Users/myuser/myproject/node_modules/babel-traverse/lib/context.js:103:17) at TraversalContext.visit (/Users/myuser/myproject/node_modules/babel-traverse/lib/context.js:190:19) at Function.traverse.node (/Users/myuser/myproject/node_modules/babel-traverse/lib/index.js:114:17) at NodePath.visit (/Users/myuser/myproject/node_modules/babel-traverse/lib/path/context.js:115:19) at TraversalContext.visitQueue (/Users/myuser/myproject/node_modules/babel-traverse/lib/context.js:150:16) at TraversalContext.visitSingle (/Users/myuser/myproject/node_modules/babel-traverse/lib/context.js:108:19) at TraversalContext.visit (/Users/myuser/myproject/node_modules/babel-traverse/lib/context.js:192:19) at Function.traverse.node (/Users/myuser/myproject/node_modules/babel-traverse/lib/index.js:114:17) ...

`

wataru358 avatar Feb 23 '18 21:02 wataru358

Facing the same error on a new create-react-app project. Haven't yet found anything to add to the discussion though.

hovik-geodakyan avatar Feb 24 '18 20:02 hovik-geodakyan

Thank you folks, seems related to https://github.com/vacuumlabs/babel-plugin-extensible-destructuring/issues/22

hleumas avatar Feb 25 '18 20:02 hleumas

Aye, it is. Sorry about the long hiatus, hopefully I didn't ruin all y'all workdays. I have posted a new PR, #26 , that looks at the version number instead of testing for existence of the deprecated function. The problem being it's still there and just throwing stack traces.

I've managed to build my own project (3k+ modules) with both Webpack 3/Babel 6, and Webpack 4/Babel 7.

Just a sidenote, this plugin replaces babel/plugin-transform-destructuring, the two should probably not be used at the same time.

Again, sorry about last time.

palnes avatar Aug 01 '18 14:08 palnes

@wataru358 Has this been resolved by the latest version?

palnes avatar Aug 22 '18 18:08 palnes

@palnes Workes like a charm. Thank you.

hovik-geodakyan avatar Aug 22 '18 19:08 hovik-geodakyan

This should probably be closed. :)

palnes avatar Jan 21 '19 17:01 palnes