Skip to content

Add .cjs file extension support #1207

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

Merged
merged 1 commit into from
May 11, 2020
Merged

Add .cjs file extension support #1207

merged 1 commit into from
May 11, 2020

Conversation

rwjblue
Copy link
Contributor

@rwjblue rwjblue commented May 11, 2020

As of Node 13.2.0, the --experimental-modules flag was removed making usage of ES modules available by default. As part of the Node ES modules support, they allow a package to define their default module type (which is how .js files are interpretted) and also allow using either .cjs or .mjs to explicitly declare a given file is of one format or the other.

We already had the .mjs extension supported so this adds .cjs to round out support for Node's ES module system.

References:

As of Node 13.2.0, the `--experimental-modules` flag was removed making
usage of ES modules available by default. As part of the Node ES modules
support, they allow a package to define their default module type (which
is how `.js` files are interpretted) and also allow using either `.cjs`
or `.mjs` to explicitly declare a given file is of one format or the
other.

We already had the `.mjs` extension supported so this adds `.cjs` to
round out support for Node's ES module system.

References:

* [v13.2.0 release post unflagging `--experimental-modules`](https://nodejs.org/en/blog/release/v13.2.0/)
* [v14 documentation of ES Modules](https://nodejs.org/api/esm.html)
@amadeus amadeus merged commit 3c90d0c into pangloss:master May 11, 2020
@amadeus
Copy link
Collaborator

amadeus commented May 11, 2020

Thanks for this!

@rwjblue rwjblue deleted the patch-1 branch May 11, 2020 16:30
@woss
Copy link

woss commented May 17, 2021

i'm using spacevim and wondering is this project part of it or not?

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.

3 participants