Tree Shaking
See original GitHub issueIf there are 2 components which both import their respective css files which are imported in an index.js
and exported out. Then in another module only one of them is imported, both css files are added to the extracted CSS file. The JS said of it tree shakes the component not being used, but that is not the case of the CSS.
Is there a way to exclude CSS imports that are not being used by the solution?
Issue Analytics
- State:
- Created 5 years ago
- Comments:7
Top Results From Across the Web
Tree shaking - MDN Web Docs Glossary
Tree shaking is a term commonly used within a JavaScript context to describe the removal of dead code. It relies on the import...
Read more >Tree Shaking - webpack
Tree shaking is a term commonly used in the JavaScript context for dead-code elimination. It relies on the static structure of ES2015 module...
Read more >Tree shaking - Wikipedia
In computing, tree shaking is a dead code elimination technique that is applied when optimizing code. Often contrasted with traditional single-library dead ...
Read more >Tree-Shaking: A Reference Guide - Smashing Magazine
Simply put, tree-shaking means removing unreachable code (also known as dead code) from a bundle. As Webpack version 3's documentation states: “ ...
Read more >Reduce JavaScript payloads with tree shaking - web.dev
Tree shaking is a form of dead code elimination. The term was popularized by Rollup, but the concept of dead code elimination has...
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
I just published a module which enables this (works for inlined CSS only).
I’m glad for any feedback: https://github.com/dferber90/rollup-plugin-postcss-treeshakeable
I am currently trying to get this working, purgecss looks superior:
https://github.com/FullHuman/rollup-plugin-purgecss