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

Migrate source code to ESM #1035

Closed
wants to merge 2 commits into from
Closed

Migrate source code to ESM #1035

wants to merge 2 commits into from

Conversation

ericcornelissen
Copy link
Owner

@ericcornelissen ericcornelissen commented Jun 8, 2024

Closes #175

Summary

Update JavaScript from CJS to ESM where possible.

The ESLint configuration cannot be converted until we upgrade to ESLint v9, everything else is updated. Similarly, the Mocha configuration cannot be converted because Mocha does not yet support ESM-based configuraiton files.

Note that the build output is still CJS, hence the change to the name of the build output.

Update JavaScript from CJS to ESM where possible. The ESLint
configuration cannot be converted until we upgrade to ESLint v9,
everything else is updated.

Note that the build output is still CJS, hence the change to the name of
the build output.
@github-actions github-actions bot added dependencies Changes to the project's dependencies test Relates to testing ci Relates to continuous integration meta Relates to the project or repository itself labels Jun 8, 2024
Make the Mocha configuration dynamic to support different configuration
based on the current Node.js version. This is necessary because older
supported Node.js versions require the "loader" option while newer
versions require the "import" option.

The configuration file must be in CJS because Mocha doesn't support ESM
yet.
@ericcornelissen
Copy link
Owner Author

Given the various "hacks" necessary to make this work (dynamic Mocha configuration, setting NODE_OPTIONS for Stryker), as well as the fact that some dependencies don't support ESM yet, I think for now it makes sense to just stick with CommonJS for JavaScript scripts in this project.

This may be revisited later.

@ericcornelissen ericcornelissen deleted the 175-migrate-to-esm branch June 9, 2024 09:37
@ericcornelissen ericcornelissen removed test Relates to testing ci Relates to continuous integration labels Jun 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Changes to the project's dependencies meta Relates to the project or repository itself
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Convert scripts to ESM syntax
1 participant