Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] build failed on destructing rest parameters #1039

Open
zhanghaobin opened this issue Apr 18, 2023 · 1 comment
Open

[Bug] build failed on destructing rest parameters #1039

zhanghaobin opened this issue Apr 18, 2023 · 1 comment

Comments

@zhanghaobin
Copy link

Description

Build failed when destructing rest parameters

Version

microbundle@^0.15.1

Reproduce steps

  1. input file
// test.ts

export function A(...[a, b]: any[]) {}
  1. build
    microbundle -i test.ts -o test.js

  2. build failed

(babel plugin) TypeError: ~/node-demo/test.ts: Cannot read properties of undefined (reading 'referencePaths')
TypeError: ~/node-demo/test.ts: Cannot read properties of undefined (reading 'referencePaths')
    at Map.RestElement (~/node-demo/node_modules/microbundle/dist/cli.js:134:19)
    at NodePath._call (~/node-demo/node_modules/@babel/traverse/lib/path/context.js:45:20)
    at NodePath.call (~/node-demo/node_modules/@babel/traverse/lib/path/context.js:35:17)
    at NodePath.visit (~/node-demo/node_modules/@babel/traverse/lib/path/context.js:80:31)
    at TraversalContext.visitQueue (~/node-demo/node_modules/@babel/traverse/lib/context.js:86:16)
    at TraversalContext.visitMultiple (~/node-demo/node_modules/@babel/traverse/lib/context.js:61:17)
    at TraversalContext.visit (~/node-demo/node_modules/@babel/traverse/lib/context.js:107:19)
    at traverseNode (~/node-demo/node_modules/@babel/traverse/lib/traverse-node.js:18:17)
    at NodePath.visit (~/node-demo/node_modules/@babel/traverse/lib/path/context.js:86:52)
    at TraversalContext.visitQueue (~/node-demo/node_modules/@babel/traverse/lib/context.js:86:16)
    at TraversalContext.visitSingle (~/node-demo/node_modules/@babel/traverse/lib/context.js:65:19)
    at TraversalContext.visit (~/node-demo/node_modules/@babel/traverse/lib/context.js:109:19)
    at traverseNode (~/node-demo/node_modules/@babel/traverse/lib/traverse-node.js:18:17)
    at NodePath.visit (~/node-demo/node_modules/@babel/traverse/lib/path/context.js:86:52)
    at TraversalContext.visitQueue (~/node-demo/node_modules/@babel/traverse/lib/context.js:86:16)
    at TraversalContext.visitMultiple (~/node-demo/node_modules/@babel/traverse/lib/context.js:61:17)
    at TraversalContext.visit (~/node-demo/node_modules/@babel/traverse/lib/context.js:107:19)
    at traverseNode (~/node-demo/node_modules/@babel/traverse/lib/traverse-node.js:18:17)
    at traverse (~/node-demo/node_modules/@babel/traverse/lib/index.js:49:34)
    at NodePath.traverse (~/node-demo/node_modules/@babel/traverse/lib/path/index.js:108:24)
    at PluginPass.Program (~/node-demo/node_modules/microbundle/dist/cli.js:175:14)
    at newFn (~/node-demo/node_modules/@babel/traverse/lib/visitors.js:149:21)
    at NodePath._call (~/node-demo/node_modules/@babel/traverse/lib/path/context.js:45:20)
    at NodePath.call (~/node-demo/node_modules/@babel/traverse/lib/path/context.js:35:17)
    at NodePath.visit (~/node-demo/node_modules/@babel/traverse/lib/path/context.js:80:31)
    at TraversalContext.visitQueue (~/node-demo/node_modules/@babel/traverse/lib/context.js:86:16)
    at TraversalContext.visitSingle (~/node-demo/node_modules/@babel/traverse/lib/context.js:65:19)
    at TraversalContext.visit (~/node-demo/node_modules/@babel/traverse/lib/context.js:109:19)
    at traverseNode (~/node-demo/node_modules/@babel/traverse/lib/traverse-node.js:18:17)
    at traverse (~/node-demo/node_modules/@babel/traverse/lib/index.js:49:34)
    at transformFile (~/node-demo/node_modules/@babel/core/lib/transformation/index.js:81:29)
    at transformFile.next (<anonymous>)
    at run (~/node-demo/node_modules/@babel/core/lib/transformation/index.js:24:12)
    at run.next (<anonymous>)
    at transform (~/node-demo/node_modules/@babel/core/lib/transform.js:22:41)
    at transform.next (<anonymous>)
    at step (~/node-demo/node_modules/gensync/index.js:261:32)
    at ~/node-demo/node_modules/gensync/index.js:273:13
    at async.call.result.err.err (~/node-demo/node_modules/gensync/index.js:223:11)
@cemrehancavdar
Copy link

I had exact error, and saw this.
Thanks to point it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants