babel-preset-modernize icon indicating copy to clipboard operation
babel-preset-modernize copied to clipboard

TypeError: Cannot read property 'constant' of undefined

Open DreierF opened this issue 4 years ago • 4 comments

(node:77743) UnhandledPromiseRejectionWarning: TypeError: .../.....2d2e7a10.js: Cannot read property 'constant' of undefined
    at PluginPass.FunctionExpression|FunctionDeclaration (.../node_modules/babel-preset-modernize/dist/plugins/transform-iife-arrows/index.js:1:424)
    at newFn (.../node_modules/@babel/traverse/lib/visitors.js:175:21)
    at NodePath._call (.../node_modules/@babel/traverse/lib/path/context.js:55:20)
    at NodePath.call (.../node_modules/@babel/traverse/lib/path/context.js:42:17)
    at NodePath.visit (.../node_modules/@babel/traverse/lib/path/context.js:92:31)
    at TraversalContext.visitQueue (.../node_modules/@babel/traverse/lib/context.js:115:16)
    at TraversalContext.visitSingle (.../node_modules/@babel/traverse/lib/context.js:84:19)
    at TraversalContext.visit (.../node_modules/@babel/traverse/lib/context.js:143:19)
    at Function.traverse.node (.../node_modules/@babel/traverse/lib/index.js:82:17)
    at traverse (.../node_modules/@babel/traverse/lib/index.js:64:12)

Caused by this line

DreierF avatar Dec 12 '20 12:12 DreierF

Ah interesting, it should just be skipping things without a binding. Thanks for the error report!

developit avatar Dec 14 '20 02:12 developit

I ran into this error, and then made a simple patch to check !binding, but then ran into this next (not sure if related or should open a new ticket):

HookWebpackError: /Users/n8/dish/dish-app/static/js/app.9bb14696b5da5188a1a3.js: Cannot read property 'arguments' of undefined
    at makeWebpackError (/Users/n8/dish/node_modules/webpack/lib/HookWebpackError.js:49:9)
    at /Users/n8/dish/node_modules/webpack/lib/Compilation.js:2107:11
    at eval (eval at create (/Users/n8/dish/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:66:1)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
-- inner error --
TypeError: /Users/n8/dish/dish-app/static/js/app.9bb14696b5da5188a1a3.js: Cannot read property 'arguments' of undefined
    at NodePath._getKey (/Users/n8/dish/node_modules/@babel/traverse/lib/path/family.js:194:25)
    at NodePath.get (/Users/n8/dish/node_modules/@babel/traverse/lib/path/family.js:186:17)
    at NodePath._getPattern (/Users/n8/dish/node_modules/@babel/traverse/lib/path/family.js:226:21)
    at NodePath.get (/Users/n8/dish/node_modules/@babel/traverse/lib/path/family.js:188:17)
    at visitParam (/Users/n8/dish/node_modules/babel-preset-modernize/dist/plugins/transform-destructuring/index.js:1:5836)
    at Array.forEach (<anonymous>)
    at PluginPass.Function (/Users/n8/dish/node_modules/babel-preset-modernize/dist/plugins/transform-destructuring/index.js:1:7244)
    at newFn (/Users/n8/dish/node_modules/@babel/traverse/lib/visitors.js:175:21)
    at NodePath._call (/Users/n8/dish/node_modules/@babel/traverse/lib/path/context.js:55:20)
    at NodePath.call (/Users/n8/dish/node_modules/@babel/traverse/lib/path/context.js:42:17)
caused by plugins in Compilation.hooks.processAssets
TypeError: /Users/n8/dish/dish-app/static/js/app.9bb14696b5da5188a1a3.js: Cannot read property 'arguments' of undefined
    at NodePath._getKey (/Users/n8/dish/node_modules/@babel/traverse/lib/path/family.js:194:25)
    at NodePath.get (/Users/n8/dish/node_modules/@babel/traverse/lib/path/family.js:186:17)
    at NodePath._getPattern (/Users/n8/dish/node_modules/@babel/traverse/lib/path/family.js:226:21)
    at NodePath.get (/Users/n8/dish/node_modules/@babel/traverse/lib/path/family.js:188:17)
    at visitParam (/Users/n8/dish/node_modules/babel-preset-modernize/dist/plugins/transform-destructuring/index.js:1:5836)
    at Array.forEach (<anonymous>)
    at PluginPass.Function (/Users/n8/dish/node_modules/babel-preset-modernize/dist/plugins/transform-destructuring/index.js:1:7244)
    at newFn (/Users/n8/dish/node_modules/@babel/traverse/lib/visitors.js:175:21)
    at NodePath._call (/Users/n8/dish/node_modules/@babel/traverse/lib/path/context.js:55:20)
    at NodePath.call (/Users/n8/dish/node_modules/@babel/traverse/lib/path/context.js:42:17)

natew avatar Dec 14 '20 19:12 natew

I have the same problem here, do you a solution for that?

cesarwbr avatar Jan 22 '21 20:01 cesarwbr

I believe this may be fixed in HEAD, if anyone wants to re-check. I haven't done the release yet.

developit avatar Feb 24 '21 21:02 developit