Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use Node's --experimental-detect-module #380

Closed
wants to merge 1 commit into from

Conversation

privatenumber
Copy link
Owner

@privatenumber privatenumber commented Nov 10, 2023

This is an experiment to leverage Node's new ESM detection (nodejs/node#50096) to replace the CommonJS loader.

Currently, the tests fail with require is not defined so we won't be able to use this (at least without a breaking change).

Seems like Node expects ambiguous ESM files to be written in strict ESM (e.g. no use of require(), __filename, etc.). In contrast, tsx compiles ESM to CJS (loose ESM) so it allows a mix of both ESM and CJS syntax.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant