bloomer icon indicating copy to clipboard operation
bloomer copied to clipboard

Add Tree-shaking and UMD info on Docs

Open AlgusDark opened this issue 8 years ago • 3 comments

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

AlgusDark avatar Jun 13 '17 17:06 AlgusDark

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;

AlgusDark avatar Jun 19 '17 16:06 AlgusDark

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.

AlgusDark avatar Jun 24 '17 04:06 AlgusDark

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

dacioromero avatar Mar 16 '20 14:03 dacioromero