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

Outputs an invalid code when a comment exists inside parenthesis and before async function #2805

Closed
sapphi-red opened this issue Jan 8, 2023 · 2 comments

Comments

@sapphi-red
Copy link
Contributor

When the following code is input,

(
  /* foo */
  async function () {
  console.log('async 1');
})()

the output is

/* foo */ async function() {
  console.log("async 1");
}();

and this is not a valid js code. (repl)

This happens from 0.16.14.

A real world reproduction: stackblitz (firestore has the code above. you can find the code by searching Loads a bundle and returns the list of affected collection groups. in firestore's code)

Original issue: vitejs/vite#11626

@evanw
Copy link
Owner

evanw commented Jan 8, 2023

Crap. This is the danger with printing comments. I remembered about the ones after the return and throw keywords but I forgot about these ones. I’ll fix this in the next release.

@evanw evanw closed this as completed in 7d89263 Jan 8, 2023
@sapphi-red
Copy link
Contributor Author

Thanks!

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