Fix css.d.ts double-build issues
jakearchibald opened this issue ยท 4 comments
It'll half our deploy time ๐.
The answer is to use https://github.com/Quramy/typed-css-modules rather than (or in addition to) the webpack plugin.
I tried playing around with this, but it seems https://github.com/Quramy/typed-css-modules doesn't quite work since it doesn't support Sass and tackling that is going down the rabbit hole.
I'm not quite clear why typings-for-css-modules-loader
is causing this. My understanding is that it's generating the typings asynchronously and TS isn't waiting for it? Also, possibly unrelated, but there's an issue claiming it's incompatible with webpack 4 and css-loader 1.0 which we use.
it doesn't support Sass and tackling that is going down the rabbit hole.
just replace
loader: 'typed-css-modules-loader',
with
loader: ['typed-css-modules-loader', 'sass-loader'],
That's already working that way. The idea here (I think) was to try to replace typed-css-modules-loader
in webpack with typed-css-modules
which is an (unrelated?) CLI that does a similar thing and have it be a separate step in the build. However, because this CLI doesn't support Sass, we'd also need to use the Sass CLI to get that to work, making it too convoluted as a solution IMO.
I managed to get it working #350. Bypassed the webpack plugin entirely, but that's mostly because I don't understand webpack plugins.