Unused compiled CSS classes aren't eliminated
See original GitHub issueAs titled. In the example below you can see that unused styles are bundled- I’d expect that rollup is able to remove them in context of CSS-Modules
.
var styles = {"button":"Button__button","unused":"Button__unused"};
// eslint-disable-next-line no-unused-vars
function Button() {
return /*#__PURE__*/React.createElement("div", {
className: styles.button
});
}
export default Button;
Issue Analytics
- State:
- Created 3 years ago
- Comments:6
Top Results From Across the Web
How Do You Remove Unused CSS From a Site?
To clean CSS with multiple pages just use that tool for all pages with different layouts. Then merge all exported CSS files to...
Read more >Eliminating Unused CSS - SurviveJS
It walks through your code and figures out which CSS classes are being used as often ... At best, PurgeCSS can eliminate most,...
Read more >Fix 'Remove Unused CSS' in lighthouse
The warning 'remove unused CS'S in Lighthouse appears when Lighthouse has found too many CSS rules on a page that are not being...
Read more >[JIT] unused CSS not eliminated in watch mode #4098 - GitHub
In JIT watch mode, when the last instance of a class is removed from the source files, I would expect that the class...
Read more >Purge-css is removing all css stylings instead of just the ...
Since your app is a ReactJS App, you want to purge css classes not used in the Javascript bundle compiled for the dev...
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
It’s not really a rollup thing. Property hoisting is handled by terser.
Or if you prefer the rollup CLI:
I generally use
terser --module -mc passes=3,unsafe,pure_getters
depending on the code base, but YMMV.@StarpTech I believe this is related to https://github.com/rollup/rollup/issues/2201#issuecomment-520122966