Open roninjin10 opened 3 weeks ago
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.
Description
For this PR I audited the package.json for improvements that can be made with regard to publishing a npm package.
The biggest impact of these changes is this library tree shakes now which means bundlers like webpack and vite will remove unused code creating smaller bundles and better user experience.
type: module
I added type module which makes this package an ESM package by default. ESM packages are packages using modern javascript:
Rather than commonjs
ESM works better with modern build tools like vite for end users as cjs cannot treeshake
Build cjs and esm
I updated the tsup config to build both cjs and esm. This creates universal compatability. I also updated the main, module, types, and exports fields according to best practices to properly point at these files. Previously ESM was not specified
sideEffects: false
So modern bundlers tree shake as much as possible as a best practice all packages that don't have side effects e.g.
Should specify sideEffects: false. This allows bundlers like webpack and vite to properly treeshake
Github link
I updated the github link to best practices
Testing (ignore for documentation update)
I added two lint tools that double check for compatability for npm packages
Type of change
Checklist:
Additional Notes: