Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Three shaking for blueprint v2. #2387

Closed
ghost opened this issue Apr 12, 2018 · 7 comments
Closed

Three shaking for blueprint v2. #2387

ghost opened this issue Apr 12, 2018 · 7 comments

Comments

@ghost
Copy link

ghost commented Apr 12, 2018

Bug report

  • Package version(s): 2 latest

Steps to reproduce

Just

import { Icon } from "@blueprintjs/core";

in my react app and I got this:

image

Why all this components from Blueprint?

I can understand icons (and something is happening: #2356), but not all that components which I don't need...

107.46 KB useless...

How to remove that code from my project ? Three-shaking?

@giladgray
Copy link
Contributor

duplicate of #2193. PR in progress: #2356. this will ship in 3.0, coming in a few weeks.

@giladgray
Copy link
Contributor

giladgray commented Apr 12, 2018

@johnunclesam yes, tree shaking is how you remove dead code:
https://webpack.js.org/guides/tree-shaking/

@ghost
Copy link
Author

ghost commented Apr 12, 2018

Not just for the icons, right?

PR also for all the core components?

Or still all 100 KB for just one single component?

@ghost
Copy link
Author

ghost commented Apr 16, 2018

@giladgray just for the icons or for single component also?

@giladgray
Copy link
Contributor

@johnunclesam other components should already support tree shaking, see #2042. you must enable it in your build, though. and update all deps to versions that (hopefully) support it. it doesn't come for free.

@ghost
Copy link
Author

ghost commented Apr 19, 2018

Dear @giladgray you said me to go here: #2042, but what I don't understand is how to use just one single component (maybe also using import X from "@blueprintjs/core/src...") in a new, latest create-react-app.

Is this possible today?

@giladgray
Copy link
Contributor

@johnunclesam import from "@blueprintjs/core/lib/esm/components/...".
you must import the lib/esm/ files for tree shaking (or import the entire module, which also uses those files).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant