Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix: reorder 'default' export condition to the end for compatibility #1317

Closed
wants to merge 1 commit into from
Closed

fix: reorder 'default' export condition to the end for compatibility #1317

wants to merge 1 commit into from

Conversation

iola1999
Copy link

@iola1999 iola1999 commented Jun 18, 2024

From ChatGPT

This PR addresses an issue with the package.json where the default export condition was not listed as the final entry in the exports field. While the ECMAScript specification indicates that object keys are unordered, some build tools have come to rely on the order of export conditions to function correctly. By moving the default condition to the last position, we can improve the compatibility of this package with a wider variety of build tools and environments that may depend on this ordering.

Changes made:

  • Reordered the default export condition within the .exports field of package.json to appear last for both import and require conditions.

Benefits:

  • Increases predictability and compatibility with build tools that may rely on the ordering of conditions in the exports field.
  • Aligns with community best practices for defining fallback export conditions in package.json.

Please review the changes and merge this PR if everything is in order. Thank you for considering this improvement to the package's build tool compatibility.

@Fuzzyma
Copy link
Member

Fuzzyma commented Jun 18, 2024

@iola1999 did you encounter an actual problem? Because I tested this and it worked fine.
In case I am talking to a bot: shame on you

@iola1999
Copy link
Author

@Fuzzyma

Hi, here is reproduce: https://github.com/iola1999/debug-0618-svgjs/tree/main

In case I am talking to a bot: shame on you

No, I am not a native English speaker, I just don't want to spend too much time on the wording.

@iola1999
Copy link
Author

image

After modify the order, the build works fine:

image

@Fuzzyma
Copy link
Member

Fuzzyma commented Jun 18, 2024

What a weird bug in "father". I feel like they should fix it. Its not hard to just load the default key lol.
I released a new version that fixes it. Sorry for not merging. I just fixed it locally

@Fuzzyma Fuzzyma closed this Jun 18, 2024
@iola1999
Copy link
Author

Also, these descriptions can be found in the Node.js documentation:

"default" - the generic fallback that always matches. Can be a CommonJS or ES module file. This condition should always come last.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants