-
-
Notifications
You must be signed in to change notification settings - Fork 19
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
[Feature]: support dynamic import by default #27
Comments
What versions of Node and esbuild are you using? The support range for import() was fixed here: evanw/esbuild#1772 It's not wise to make node12 the target for all runtimes, because it's untrue for non-12.x runtimes. |
I'm using [email protected] |
lukeed
added a commit
that referenced
this issue
Nov 27, 2022
lukeed
added a commit
that referenced
this issue
Nov 28, 2022
* chore: add tests to reproduce CJS dynamic-import issue; - Related #27 * feat: handle import() in CJS & backmap TS->JS resolving; - attempt to load ".ts", ".jsx" or ".tsx" file when `import` to ".js" does not exist - attempt to load ".mts" file when `import` to ".mjs" does not exist - attempt to load ".cts" file when `import` to ".cjs" does not exist - attempt to load ".tsx" file when `import` to ".jsx" does not exist * chore: wrap ESM test file in async iife * derp~!
3 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
when I use tsm register to transpile module which contains dynamic import, it's broken
It's broken

It's because esbuild will keep dynamic import for high version of node, even you set format=cjs evanw/esbuild#1636

when I set target to node12, it works fine now, because it will transform dynamic import to require
so I think we could set target=node12 by default to support dynamic import by default
The text was updated successfully, but these errors were encountered: