Help Compiling to ESM from TypeScript #1206
Unanswered
angelhdzdev
asked this question in
Q&A
Replies: 1 comment 1 reply
-
UpdateI found a workaround. Instead of leaving the builders (unbuild, esbuild) to pack inquirer in the .dist, I defined a dummy prompt function. So my guess is that inquirer depends on packages that are not being converted to ESM... |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi. I'm having troubles compiling TypeScript projects that use
inquirer
.All kind of errors. First it was
string_decoder
. Now it'sError: Dynamic require of "assert" is not supported
.Every time, I just remove inquirer and the apps compile without issues.
First it was a
Nuxt 3
project. Then a pure TypeScript project with 3 dummy files.First I used
unbuild
package to compile. Now I'm usingesbuild
with:
pnpx esbuild ${file}.ts --outfile=.dist/${file}.mjs --platform=node --format=esm --bundle
I tried using dynamic import to no avail.
Any tip will be appreciated.
Beta Was this translation helpful? Give feedback.
All reactions