-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Dynamic Imports flag not respected #9174
Comments
|
@kdy1 That works for JSON files, but is there any way to do dynamic import of code? Was hoping to use |
You can compile directory instead of specifying only entry file |
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Describe the bug
Dynamically importing files and modules in the code will lead swc to believe the module or file is unused and omit it during compilation. Even if
dynamicImport
is set to true in parser options.Input code
Config
Playground link (or link to the minimal reproduction)
https://github.com/Larsundso/swc-dynamic-import
SWC Info output
-- OS 1
-- OS 2
Expected behavior
lang.json should be compiled into /dist
the program should log its contents into the console
Actual behavior
lang.json is missing from /dist
the program fails with the following error
Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/swc-dynamic-import/dist/lang.json' imported from /swc-dynamic-import/dist/index.js
Version
1.6.12-nightly-20240706.1
Additional context
No response
The text was updated successfully, but these errors were encountered: