React: Make modules tree-shakable
See original GitHub issueThe problem
Though we know that import { namedImport } from 'package-name'
has negative effects on application bundle size and build time and we have migrated away from it in our internal code, it’s easier to use for our adopters and still want to provide good support for this usage.
The solution
- Add
/*#__PURE__*/
annotations (with wrapping contents in IIFE as necessary). - Upgrade to latest Babel for better React component optimization.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
How to Make Your React Component Library Tree Shakeable
What is tree shaking and why? · Include native module format · Inform app bundlers that there are no side effects · Preserve...
Read more >How to write a tree-shakable component library
Tree Shaking in React How to write a tree-shakable component library ... ES Modules make it possible for bundlers to tree-shake your code....
Read more >How to create a lean, tree-shakeable React Design System ...
The important thing to know is that ESM modules can be statically analyzed to allow build tools (like Webpack or Rollup) to perform...
Read more >How To Make Tree Shakeable Libraries - Theodo blog
Check whether the library is tree shakeable by testing it against a known application in a controlled environment; Use ES6 modules so bundlers ......
Read more >How do you make a library truly tree-shakable with webpack?
in my case, I imported some of the components from Reactstrap library ... I believe you also need the module property on your...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@RobertaJHahn @asudoh moving this one out.
No longer applies. Does not apply to React Wrappers.