Closed Conaclos closed 2 years ago
Glad you like my project :)
I doubt changing output extension is useful tho. { "type": "module" }
package.json
marks all .js
files in the directory as ESM. If you write Node-only, Node.js ^12.20.0 || >=14.13.1
allows to use named imports on CJS. And if you need ESM for browsers, https://www.npmjs.com/package/sucrase can transpile to CJS (from ESM) way faster than deno2node.
Still, I wouldn't mind a PR extending https://github.com/wojpawlik/deno2node/blob/main/src/emit.ts to vary output extension based on "target"
.
Hi! Thanks for your work.
I would like to propose a CLI option to choose the output extension of files and imports. In some cases, it could be useful to output
cjs
extension ormjs
extension. This is useful to publish node package that support both esm and commonjs.