-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Support passthrough dynamic import, or basic code doesn't work #3707
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
Comments
The same goes for |
We need some way to distinguish between imports that should be rewritten and those that folks want to preserve. |
Just want to link to this comment here as well - for the "just minify" case I think it would be fine to have a flag that just says "pass through all imports/modules features without changing them". |
Yeah, it would be great if I could tell the compiler not to worry about |
Note that there is already an open issue for dynamic import support I guess this one is asking for something a bit more targeted, but I'm still a bit inclined to close this as a duplicate so all the discussion will be in one place. @AshleyScirra wdyt? |
I think #2770 is asking for full support. I'm only asking here for Closure Compiler not to fail compilation due to the presence of dynamic import, i.e. the minimum possible support. I think there's basically three levels of support:
I'd have thought passthrough is more or less trivial, whereas full support would involve more significant work. |
@AshleyScirra do you feel this issue would be completely closed by the following behavior? If the compiler's output is set to at least
|
Yes, that sounds like it would do it. |
Has this issue been addressed yet? I've had to revert to an earlier version to compile a project I'm working on, because dynamic import causes the compiler to exit with an error. |
There is a PR for basic pass through support under review: #3706. |
Great, thanks. I'll watch for it. |
Looks like PR above addressed dynamic import, but |
dynamic import and import.meta are now supported |
There's a couple of more places that need to support import.meta. |
Please at least support a basic passthrough for dynamic import for Closure Compiler. In the current version, any presence of dynamic import at all causes a compilation failure. This causes even basic use cases of dynamic import to cause the entire compilation to fail.
Example in.js:
Command line:
java -jar ./closure-compiler.jar --js in.js --js_output_file out.js --compilation_level SIMPLE --formatting PRETTY_PRINT --language_in ECMASCRIPT_2020 --language_out ECMASCRIPT_2020
Observed result:
No output file is generated.
Expected result:
Just output the file with all transforms, but passthrough
import(XYZ)
->import(XYZ)
This is blocking us using JavaScript modules at all in our code. We want to insert a dynamic import, but then Closure Compiler will refuse to process any of our code at all.
The text was updated successfully, but these errors were encountered: