-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Support import(...) in ESTree->Terser conversion #12365
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
Support import(...) in ESTree->Terser conversion #12365
Conversation
A bit crude, since Terser doesn't have a dedicated dynamic import AST node type, but verified that it works. Fixes emscripten-core#11303 (now for real).
|
Should you make this a PR upstream? |
|
No, our version has already diverged, plus as mentioned in the description this is a limited support just for our use-case; proper upstream support would be much more involved and different from this PR. |
|
Tests passed! |
|
Should there be a test case as part of this change? |
|
Mayyyybe 😅 |
|
I guess I was somewhat discouraged by your TODO / comment here: emscripten/tests/test_other.py Lines 186 to 188 in a534224
But I guess I could add a test that simply verifies this combination of flags compiles at all. |
|
(working on it) |
|
Sounds good. Just added a compile-only test would be acceptable for now.. given that TODO. If you are interested in this area perhaps we might want to find a way to do actual testing of the generated ES6 modules. |
|
Added a test and verified that it fails without the fix and works with the fix. |
sbc100
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm but I don't know the terser code.. @azakai can you take a look?
FWIW I kind of know that file because I implemented quite a few parts of it back in 2014 when it was still UglifyJS, but an extra pair of eyes is surely welcome 😅 |
sbc100
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok sgtm
A bit crude, since Terser doesn't have a dedicated dynamic import AST node type, but verified that it works.
Fixes #11303 (now for real).