Skip to content

Conversation

@spacebear21
Copy link

See #324 for background.

The TS
documentation states that:

"Node.js’s rules for module format detection and interoperability make it incorrect to specify module as esnext or commonjs for projects that run in Node.js, even if all files emitted by tsc are ESM or CJS, respectively. The only correct module settings for projects that intend to run in Node.js are node16 and nodenext. While the emitted JavaScript for an all-ESM Node.js project might look identical between compilations using esnext and nodenext, the type checking can differ. See the reference section on nodenext for more details."

This change makes the project runnable in Node.js by changing the module compiler option to "nodenext", and fixing the imports accordingly.

The TS
[documentation](https://www.typescriptlang.org/docs/handbook/modules/theory.html#the-module-output-format)
states that:

"Node.js’s rules for module format detection and interoperability make
it incorrect to specify module as esnext or commonjs for projects that
run in Node.js, even if all files emitted by tsc are ESM or CJS,
respectively. The only correct module settings for projects that intend
to run in Node.js are node16 and nodenext. While the emitted JavaScript
for an all-ESM Node.js project might look identical between compilations
using esnext and nodenext, the type checking can differ. See the
reference section on nodenext for more details."

This change makes the project runnable in Node.js by changing the module
compiler option to "nodenext", and fixing the imports accordingly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant