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

Babel transform syntax error: Unable to handle nested super.prop usage #835

Open
DyncMark opened this issue Apr 28, 2021 · 1 comment
Open
Labels

Comments

@DyncMark
Copy link

[os]:

  • macOS Catalina 10.15.4
  • nodejs v14.4.0
  • microbundle 0.13.0

[error log]:


$ microbundle
(babel plugin) SyntaxError: /Users/chudong/workBench/xxxxx/src/tracks/microphone_audio_track.ts: Unable to handle nested super.prop usage
  42 |         return new Promise(async (resolve, reject) => {
  43 |             if (unClose) {
> 44 |                 super.setEnabled(enabled);
     |                 ^^^^^^^^^^^^^^^^
  45 |                 resolve();
  46 |                 return;
  47 |             }
SyntaxError: /Users/chudong/workBench/xxxxx/src/tracks/microphone_audio_track.ts: Unable to handle nested super.prop usage
  42 |         return new Promise(async (resolve, reject) => {
  43 |             if (unClose) {
> 44 |                 super.setEnabled(enabled);
     |                 ^^^^^^^^^^^^^^^^
  45 |                 resolve();
  46 |                 return;
  47 |             }
    at File.buildCodeFrameError (/Users/chudong/workBench/xxxxx/node_modules/@babel/core/lib/transformation/file/file.js:240:12)
    at NodePath.buildCodeFrameError (/Users/chudong/workBench/xxxxx/node_modules/@babel/traverse/lib/path/index.js:138:21)
    at hoistFunctionEnvironment (/Users/chudong/workBench/xxxxx/node_modules/@babel/traverse/lib/path/conversion.js:194:27)
    at NodePath.arrowFunctionToExpression (/Users/chudong/workBench/xxxxx/node_modules/@babel/traverse/lib/path/conversion.js:105:23)
    at PluginPass.ArrowFunctionExpression (/Users/chudong/workBench/xxxxx/node_modules/@babel/preset-modules/lib/plugins/transform-async-arrows-in-class/index.js:37:14)
    at newFn (/Users/chudong/workBench/xxxxx/node_modules/@babel/traverse/lib/visitors.js:175:21)
    at NodePath._call (/Users/chudong/workBench/xxxxx/node_modules/@babel/traverse/lib/path/context.js:55:20)
    at NodePath.call (/Users/chudong/workBench/xxxxx/node_modules/@babel/traverse/lib/path/context.js:42:17)
    at NodePath.visit (/Users/chudong/workBench/xxxxx/node_modules/@babel/traverse/lib/path/context.js:92:31)
    at TraversalContext.visitQueue (/Users/chudong/workBench/xxxxx/node_modules/@babel/traverse/lib/context.js:116:16)

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
@developit
Copy link
Owner

developit commented May 27, 2021

Interesting! This is actually a bug in @babel/preset-modules.

Here's the bug reproduced in the Babel repl.

I've opened babel/preset-modules#31 to track getting a fix in.

In the meantime, the quick fix is to not use an async function as a promise initializer (which is generally not recommended anyway, since doing so actually swallows errors!).

@developit developit changed the title [BUG] (babel plugin) SyntaxError: /Users/chudong/workBench/xxx/audio_track.ts: Unable to handle nested super.prop usage Babel transform syntax error: Unable to handle nested super.prop usage May 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants