react-app-rewire-typings-for-css-module

Use css-modules-typescript-loader for generate *.d.ts file for css module(Both *.module.css and *.modules.scss

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
react-app-rewire-typings-for-css-module
4.0.33 years ago5 years agoMinified + gzip package size for react-app-rewire-typings-for-css-module in KB

Readme

react-app-rewire-typings-for-css-module
Build Status

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);