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
Invalid code generated from large minified file #2684
Comments
Rollup doesn't emit parens for ternary consequent and alternate.
|
An amusing variation that produces syntactically valid but incorrect code:
|
|
The comma operator has the same issue:
|
Fix at #2696. I can confirm that this also resolves the original issue provided one allocates more than the default amount of memory to node when running acorn. It turned out the issue was surprisingly easy to fix as the necessary concepts had already been introduced to Rollup's code quite some time ago to handle some other edge cases. If you can find more issues of this kind, please let us know! |
@kzc Impressive troubleshooting! |
How Do We Reproduce?
repo: rollup-treeshake-issue
input: prettier/vendor/parser_typescript.js
I'm importing a minified 2Mb js file without dependencies. With default settings, the output is invalid. When using
treeshake: false
, the output is valid.input: 2 173 862 bytes => syntax ok
output: 2 167 342 bytes => syntax error near 3rd occurence of "emitDecoratorMetadata"
error message when executing output: Unexpected token (11:1264563)
Expected Behavior
Rollup outputs valid code without syntax errors.
Actual Behavior
Syntax error in output file on line 11 column 1264563. 🙄
A closer look
Notice that the functions on line 5&6 don't have a name (expected identifier)
The text was updated successfully, but these errors were encountered: