Closed hardfist closed 1 year ago
What versions of Node and esbuild are you using? The support range for import() was fixed here: https://github.com/evanw/esbuild/issues/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 node@16.8.0
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 https://github.com/evanw/esbuild/issues/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