CSS Modules with TypeScript: css-modules-typescript-loader
Created by: jednano
TypeScript users are flying blind when they import a CSS module. For example, if they type styles.foo
they have no idea if .foo
actually exists in the CSS module without manually checking the file.
This is not a great TypeScript experience.
I propose adding the css-modules-typescript-loader
(or something similar) to emit type declarations for CSS modules on the fly.
It could be as simple as this:
const loaders = [
require.resolve('style-loader'),
...(useTypeScript && cssOptions.modules
? require.resolve('css-modules-typescript-loader')
: []
),
What do you think?