commerce-sdk-isomorphic
commerce-sdk-isomorphic copied to clipboard
Fix Annoying things with this Package.
Why this Change?
This package is currently misconfigured. Running it through publint it has a few errors that need to be addressed.
The main problem being that the ESM configuration is currently misconfigured causing this package to fail to build in ESM centric environments like Vite.
- node-fetch import is also always a require which causes ESM builds to fail.
There are also a few other annoying things with this package that should be addressed.
- React is a peer dependency even though this package compiles to pure JS and works perfectly fine without React.
- There is no option to supply your own fetch function basically forcing you to use 2 outdated fetch functions even if you have no need for them.
What was done
- Correctly configured package.json
- added
exports
field - removed deprecated
module
field - added
packageManager
field so people can more easily contribute to the project
- added
- Added optional
fetchFunction
property to config so that you can supply your own fetch function if you don't like the 2 supplied - Fixed
node-fetch
import - updated
node-fetch
Conclusion
These changes most likely constitute a breaking change to users on older versions of Node. However, currently these problems currently make this package completely unusable to people on newer versions or using ESM so I think that the juice is worth the squeeze.