svgdotjs / svg.js

The lightweight library for manipulating and animating SVG
https://svgjs.dev
Other
10.95k stars 1.07k forks source link

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

Closed iola1999 closed 2 weeks ago

iola1999 commented 2 weeks ago

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:

Benefits:

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 commented 2 weeks ago

@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 commented 2 weeks ago

@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 commented 2 weeks ago
image

After modify the order, the build works fine:

image
Fuzzyma commented 2 weeks ago

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

iola1999 commented 2 weeks ago

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.