-
-
Couldn't load subscription status.
- Fork 18
Closed
Description
when I use tsm register to transpile module which contains dynamic import, it's broken
- src/index.ts
async function main(){
const mod = await import('./lib');
}
main();- src/lib.ts
export const answer = 42;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
- tsm.js
module.exports = {
common: {
target: 'node12'
}
}
so I think we could set target=node12 by default to support dynamic import by default
leeight and vanyauhalin
Metadata
Metadata
Assignees
Labels
No labels