Rewrites the class to a unique generated name at build time and exports a mapping object
The build-time rewrite option is right. CSS Modules is a build step. It scopes class names locally by generating unique names, like Button_button__x7f2a. It also exports an object, so you use styles.button in your markup. The output is plain static CSS, so there is no runtime cost.
"Injects the styles at runtime" is the tempting wrong answer. That describes runtime CSS-in-JS libraries, not CSS Modules. CSS Modules also doesn't use Shadow DOM or inline style attributes.
Read more