bloomer
bloomer copied to clipboard
Add Tree-shaking and UMD info on Docs
Bloomer is able to be used with Tree-shaking thanks to bloomer/esm and already has module | jsnext:main in package.json.
Also, you can use it with UMD thanks to www.unpkg.com
Actually, we have this "side effects" on every component since we export default withHelpersModifiers HOC, so... we need to add the annotation /*@__PURE__*/ in function call to let uglify remove it:
const HOC = /*@__PURE__*/withHelpersModifiers(Component)
export default HOC;
We need to wait until resolution of https://github.com/Microsoft/TypeScript/issues/16727, and/or https://github.com/Microsoft/TypeScript/issues/13721 to see how we can implement Tree-Shaking because right now, TSC is removing /*@__PURE__*/ comment.
I noticed this was marked as done, but there's still a minor issue with it.
The "browser" field in bloomer's package.json causes webpack to load the non-esm code which results in worse tree-shaking. https://github.com/AlgusDark/bloomer/blob/b9af8271840c9a52ecf493f3b1f919d8cd3e5fc1/package.json#L9
See https://github.com/webpack/webpack/issues/4674