-
Notifications
You must be signed in to change notification settings - Fork 97
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
Breaking changes in v2.0.3 #257
Comments
Thanks for retorting this @donmccurdy, and sorry for the inconvenience!
yes I'm gonna do that |
@donmccurdy just released 2.0.7, could you please check it ? |
Ok seems like it's OK:
|
@donmccurdy ok so 2.0.7 is now like 2.0.2 Change: 2f1d9ef |
Thanks @mattallty! v2.0.7 is working as expected. I don't have an opinion on 2f1d9ef, those changes look fine. Perhaps "import" should be renamed as "default" based on https://nodejs.org/api/packages.html#conditional-exports, but that isn't causing issues for me either way. Here's how I set up the exports, just as FYI — I don't know whether that is any better or worse than what you've chosen, but I've been doing it this way in other projects for a while. At first glance, I think your configuration on the 3.x branch is valid when a downstream ESM project uses - import type { Argument } from "../types"
- import type { Command } from "../command"
+ import type { Argument } from "../types.js"
+ import type { Command } from "../command/index.js" Perhaps it's possible to configure your build system to do this. Type definitions would need to do the same. In my own libraries I've found it easier to just switch to Complete changes required would be: Happy to open a PR for those changes if you're interested. |
Thanks a lot for the feedback @donmccurdy! By reading this: https://www.typescriptlang.org/docs/handbook/esm-node.html#new-file-extensions
and your link:
... I'm also wondering if I could also play with file extensions (cjs and mjs) to let Node & TS guess the exact format, but that's just my understanding, I still have to dig deeper. Anyway, thanks for the help! |
By Node's interpretation I think it's just the implicit file extensions that are preventing v3.x from working in my builds now. This includes imports pointing to external dependencies |
Moving from v2.0.2 → v2.0.3 is a breaking change. In my own application the code below...
... now throws this error:
That error can be fixed by doing
import type * as caporal ...
instead, but a number of other issues remain, related to the fact that Caporal is now being imported as ESM rather than CJS. The specifics here would depend on a user's build system, and also module resolution settings in TypeScript (if applicable).I believe the issue is caused by introduction of the
package.json#exports
field. While it is technically possible to introduce that field without a breaking change, it is very difficult in practice. It's considered best practice to only add theexports
field in a major release.Perhaps it would be possible to publish v2.0.7 as a duplicate of v2.0.2, and leave the breaking changes for v3?
The text was updated successfully, but these errors were encountered: