code4romania / taskforce-fe-components

reusable frontend components for taskforce projects
https://taskforce-fe-components.now.sh
Mozilla Public License 2.0
11 stars 34 forks source link

Try to make bundle size smaller #179

Closed Utwo closed 4 years ago

Utwo commented 4 years ago

What changed?

Exported everything with a specific named export. Add module:false in babel config. Add commonjs plugin in rollup config.

I still don't know if this is enough for the consumer app to tree-shake this or not. Waiting for your help!

Actions (optional)

vercel[bot] commented 4 years ago

This pull request is being automatically deployed with Vercel (learn more). To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/code4romania/taskforce-fe-components/oj7v7on37 ✅ Preview: https://taskforce-fe-components-git-bundle-size.code4romania.now.sh

Utwo commented 4 years ago

I will add here some interesting links: https://risanb.com/code/bundling-your-javascript-library-with-rollup/#three-shaking-gotcha https://stackoverflow.com/questions/59900538/shared-component-library-best-practices https://www.npmjs.com/package/rollup-plugin-multi-input

Utwo commented 4 years ago

I added a config to rollup in which I export in multiple bundles by hand. It's still not using tree-shaking feature but it's still a plus.

Before: old

After: new

Utwo commented 4 years ago

I think we still need to find a way to use the tree-shaking capabilities