egoist / bili

Bili makes it easier to bundle JavaScript libraries.

Home Page:https://bili.egoist.sh

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CSS Modules aren't tree shaked

StarpTech opened this issue · comments

I'd expect that unused CSS is removed from the build. This is one big advantage of CSS Modules.

Example:

Input

import styles from './index.module.css';

export default function Button() {
    return <div className={styles.button}></div>
}
.button {
  width: auto;
}
.unused {
  width: auto;
  padding: 3px;
}

Output

.index-module_button__3X3pB {
  width: auto;
}
.index-module_unused__2wMHH {
  width: auto;
}
.index-module_bar-1__3ZOpQ .bar .index-module_bar-2__rsPcN {
  color: white;
}
.page {
  padding: 20px;
}