react-app-rewire-typings-for-css-module
v4.0.3
Published
Use css-modules-typescript-loader for generate *.d.ts file for css module(Both *.module.css and *.modules.scss
Downloads
1,920
Readme
react-app-rewire-typings-for-css-module
Description
Use typings-for-css-module-loader for generate _.d.ts file for css module(Both _.module.css and *.modules.scss")
Add css-modules-typescript-loader
after css-loader to generate typedefined file,
For support css version < 2.x.x, See this older version: https://github.com/rainx/react-app-rewire-typings-for-css-module/tree/aa5239f623a731ed331b6d60a4c3359d2435493e
Usage
> yarn add --dev css-modules-typescript-loader react-app-rewire-typings-for-css-module
# or np m
> npm install --save-dev css-modules-typescript-loader react-app-rewire-typings-for-css-module
and edit your config-overrides.js
file
const rewireTypingsForCssModule = require("react-app-rewire-typings-for-css-module");
module.exports = {
webpack: function(config, env) {
/**
* Add this line
*/
config = rewireTypingsForCssModule(config);
return config;
}
};
If you wanna customized options for css-loader
you could use the factory to get a new rewireTypingsForCssModule
// no addition options
config = rewireTypingsForCssModule.factory({})(config);