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

IIFE function expression incorrectly deparenthesized when preceded by pure annotation #258

Closed
mbrock opened this issue Jul 15, 2020 · 4 comments

Comments

@mbrock
Copy link

mbrock commented Jul 15, 2020

I'm testing with esbuild 0.6.2.

The source file

/* @__PURE__ */ (function () {})()

gives the output

/* @__PURE__ */ function() {
}();

when compiled with no options. This output is not valid JavaScript: it reads as a function declaration with no name.

@mbrock
Copy link
Author

mbrock commented Jul 15, 2020

With another kind of preserved comment, the expression stays parenthesized:

/* @license */
(function() {
})();

@mbrock
Copy link
Author

mbrock commented Jul 15, 2020

The issue first appears in 0.5.22 when the support for pure annotations was added.

This kind of code is present in the RxJS compiled source, so I can't use RxJS with newer versions of esbuild, hence my report.

@evanw evanw closed this as completed in c782400 Jul 16, 2020
@evanw
Copy link
Owner

evanw commented Jul 16, 2020

Thanks so much for reporting this. Makes sense why this broke. Sorry I didn't catch it. The fix is in version 0.6.3.

@mbrock
Copy link
Author

mbrock commented Jul 16, 2020

@evanw Amazing, 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