Closed cschroeter closed 1 year ago
Although it works with node itself, you can not use dynamic imports like suggested in the error message above
(async () => {
const { pkgUpSync } = await import("pkg-up");
console.log("Hello World", pkgUpSync());
})();
I just hit this issue too. @Brooooooklyn is there any workaround? (I can't change the code to use dynamic imports.)
Same problem here...
Just found this, only to see I had the same problem a year ago ...
FYI: https://github.com/egoist/esbuild-register seems to not have this problem, so I'm switching to that for now.
Here is an minimal demo of that isssue https://github.com/cschroeter/bug-swc-esmodules/blob/main/package.json
Here is how
ts-node
tackles the issue https://github.com/TypeStrong/ts-node/issues/1007