-
-
Notifications
You must be signed in to change notification settings - Fork 47
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
Investigate if .cjs extension support is needed. #68
Comments
Node.js considers a script an ES module if it either has the file extension Node.js considers a script a CommonJS module if it either has the file extension So if a package uses |
Thanks for the additional details! That should help us make a decision.
My assumption was that we didn't support ESM with |
I don't think this is true. We call So if there is a However, if there is a |
Hey 👋 Thanks for the support for .mjs config, over at webpack-cli we use interpret to use various formats of webpack config files as per the extensions supplied by interpret, is it possible to add |
@anshumanv Can you explain a little more? node.js supports "fall through" when requiring files that don't have an extension registered, so wouldn't |
Hey @phated yes, so we use interpret to get webpack configs with valid extension whether |
Oh, that's much different than the way gulp uses list library. We use the |
Ah okay, I think it makes a lot of sense to fallback to default node loader. I've opted for the same approach 👍 Thanks @phated 💯 |
Gulp supports the `.mjs` file extension for config files (tracked at gulpjs/interpret#65). It looks like `.cjs` is not supported yet (gulpjs/interpret#68).
Gulp supports the `.mjs` file extension for config files (tracked at gulpjs/interpret#65). It looks like `.cjs` is not supported yet (gulpjs/interpret#68).
From #59, we believed that
.cjs
extension support was needed, but I think that was due to not properly supporting the ESM syntax. With the work done in gulp-cli by @snoak, we can import ESM modules.Given that, I only added support for .mjs in #65 and I wanted to open this to investigate if we actually need to support the
.cjs
extension.If we end up needing to support it, I've put in place the architecture to support & test the extension on all versions of node.
The text was updated successfully, but these errors were encountered: