ui
ui copied to clipboard
Investigate how to stop building @bufferapp/ui with commonjs
What
- [ ] Remove commonjs-related build steps.
- [ ] Make sure we are able to export independently any component (without bringing in the whole library).
- [ ] Test:
- [ ] Run https://www.npmjs.com/package/webpack-bundle-analyzer on a product repo (best to try with bufferapp/buffer-engage-client).
- [ ] Install beta version with these changes on that repo.
- [ ] Run the bundle analyzer again: we should see a decrease in size regarding what's brought by bufferapp/ui
Why
We have a Babel plugin called @babel/plugin-transform-modules-commonjs (https://babeljs.io/docs/en/babel-plugin-transform-modules-commonjs) transforming ECMAScript modules to CommonJS. Our bundle is much bigger, and we can't use tree shaking (we could have a third-party webpack plugin on top of that to get tree shaking but doesn't seem efficient)
Yes! 👏 👏 👏