4 ms·
The only thing missing for me now is that TypeScript supports it as output type. Right now you cannot use Typescript and compile it to ESM modules.
by danez 6y ago
The only thing missing for me now is that TypeScript supports it as output type. Right now you cannot use Typescript and compile it to ESM modules.
- maga 6y agoCheck out esbuild.
- no_wizard 6y agoSet `ESNext` as the value for `module` under `compilerOptions` in your TSConfig will output an ES module every time. What it doesn't support currently is changing the output file extension, if thats what you meant https://www.typescriptlang.org/tsconfig#module https://www.typescriptlang.org/tsconfig#module
- danez 6y agoRight, I remember now. The file extensions weren't correct, but even after renaming the files it does not work because the imports were also missing the correct file extension (which is mandatory in ESM mode in Node.JS). At that point I gave up.
- spankalee 6y agoTypeScript has supported JS module output since the very beginning: https://www.typescriptlang.org/tsconfig#module https://www.typescriptlang.org/tsconfig#module