-
Notifications
You must be signed in to change notification settings - Fork 156
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
Consider dual CJS/ESM export #169
Comments
Oh great idea! Would be keen to do this 😄 |
@kibertoad maybe could you help? |
@chase-manning Does https://github.com/ai/dual-publish/ look like a suitable solution for you? |
Oh yes thanks that looks like a good solution! |
Note that it would change
to
What's the problem with webpack and default exports @kibertoad ? |
@mcollina Problem is this: webpack/webpack#6584 |
Ok thanks |
The problem with this approach is that existing code that uses dataformat and CJS requires will have to change to use:
instead of
That is a huge headache for those of us that use dateformat extensively. I would prefer to see two separate npm packages:
That allows users to pick when they want to migrate over to the new ESM module, and in the meantime won't break existing code bases that depend on dateformat. And yeah....this requires (all puns intended) more work on the part of the module maintainer. |
If anyone else is having a similar problem, check out https://github.com/knowledgecode/date-and-time. it supports common js but has some formatting different from this module. I am not in any way affiliated with the project only sharing it because it solved my problem. |
If released as a semver major, how is that an issue? |
Hey @jimmywarting what's your take on this issue? 😄 |
I say go for ESM only. @sindresorhus is converting all of his 1000+ packages, I think maintaining a dual package support is a I think those who are stuck with cjs can use the previous major version and pin it to v4. That's what a semantic Major breaking change means... Don't update it if you are not ready for it. while reading pinojs/pino-pretty#235 i would hate for packages to be divided up by diffrent forks (cjs vs esm) where there are no longer one single source of truth. it would be grate if the main upstream repo got all the updates. There are still ways after all to load esm only packages using the async ESM have been out for a long time and it's marked as stable https://nodejs.org/api/esm.html I really think NodeJS should do something about this split war between cjs and esm
But i don't think i have a much saying in this as i'm just a user that have contributed to the project. I don't consider myself a Collaborator or a member of this project. If you want to support dual packages, then go for it, it's up to you. |
Nonsense. That means no security fixes because it adds more complicated developer maintenance that isn't going to be done. This is the response of people who do not maintain a large production ecosystem.
None that don't require users to refactor their code into a big pile of promises.
Impossible.
Likely also impossible due to ESM spec.
Again, this is the response of people who do not maintain large production ecosystems. Even if everything else would be viable (e.g. the budget to convert everything to a completely different paradigm were actually possible for anyone), the fact that ESM is not able to be instrumented means actual business cannot "just make the switch." Yes, semver major implies breaking changes. But we will disagree all day long that it includes completely changing the module contract. That's the realm of a new module with a new name. Don't care who is doing it. |
I'm with @jsumners on this one....well said James! The whole CommonJS vs ESM module thing is a huge stinking mess and the horns of a serious dilemma for those of us that have a large production code base to maintain and extend. |
I am not too sure if this is addressed in the right topic, but I wasn't able to use version 5.0.1, as the module.exports statement is missing in that version. So, I went back to version 4.6.3, which worked for me. I just wondered, as the ReadMe still says:
I use TypeScript and bundle modules with browserify. |
No. This seems completely off topic and should be a new issue. |
Thanks. We just ported our nodejs apps to https://github.com/knowledgecode/date-and-time. It was simple to do. |
ESM is not ready for prime time in a significant part of the Node.js usage needs the stabilization of Loaders, which are still experimental and prone to changes. Therefore I'm not ready switching my modules to be ESM-only.
Would you consider dual publishing for this module?
The text was updated successfully, but these errors were encountered: