untitledui-js icon indicating copy to clipboard operation
untitledui-js copied to clipboard

ESM Support and Tree-Shaking

Open alexbot89 opened this issue 1 year ago • 1 comments

When bundling this package with an app, tree-shaking is not occurring causing the index file to be inflated due to the import being commonJS, what should be happening is that only the icons that I want to use will be bundled without importing the entire icon set.

Reproduce

  1. Create a simple project, I used Vite
  2. Install package npm i -D untitledui-js-base
  3. Place 1 icon anywhere in App.tsx
  4. Run npm run build

Notice how the index file is quite large.

vite v5.2.11 building for production...
✓ 35 modules transformed.
dist/index.html                   0.46 kB │ gzip:   0.30 kB
dist/assets/react-CHdo91hT.svg    4.13 kB │ gzip:   2.05 kB
dist/assets/index-DiwrgTda.css    1.39 kB │ gzip:   0.72 kB
dist/assets/index-B8foZgZW.js   912.34 kB │ gzip: 213.54 kB

(!) Some chunks are larger than 500 kB after minification. Consider:
- Using dynamic import() to code-split the application
- Use build.rollupOptions.output.manualChunks to improve chunking: https://rollupjs.org/configuration-options/#output-manualchunks
- Adjust chunk size limit for this warning via build.chunkSizeWarningLimit.
✓ built in 1.02s

alexbot89 avatar May 10 '24 00:05 alexbot89

Thank you @alexbot89 for pointing this out, this issue would be address in a few days

techwithmanuel avatar May 13 '24 18:05 techwithmanuel

This issue is being address on the main library the new changes would be applied to the base library in a few hours, once again @alexbot89 thank you for pointing this out

techwithmanuel avatar May 17 '24 00:05 techwithmanuel