From 15ee1193f424f965fdd07d89c80b2fd0b7e5f3c0 Mon Sep 17 00:00:00 2001 From: Brody McKee Date: Mon, 25 May 2020 11:13:09 +0300 Subject: [PATCH] docs: add about section with limitations and reasons --- README.md | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 09f40d5..f7321c2 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,8 @@ for [CSS Modules](https://github.com/css-modules/css-modules). ## Table of contents - [typescript-plugin-css-modules](#typescript-plugin-css-modules) - - [Table of contents](#table-of-contents) + - [Table of contents](#about-this-plugin) + - [About this plugin](#table-of-contents) - [Installation](#installation) - [Importing CSS](#importing-css) - [Options](#options) @@ -28,6 +29,22 @@ for [CSS Modules](https://github.com/css-modules/css-modules). - [Troubleshooting](#troubleshooting) - [About this project](#about-this-project) +## About this plugin + +This plugin provides type information to IDEs and any other tools that work with [TypeScript language service plugins](https://github.com/microsoft/TypeScript/wiki/Writing-a-Language-Service-Plugin#whats-a-language-service-plugin). + +At this time, TypeScript does not support plugins during compilation. This means that this plugin cannot: + +- provide errors during compilation, or +- add CSS module support to your project. + +For more information, and/or to add support for this feature, see: https://github.com/microsoft/TypeScript/issues/16607. + +If you need a different solution, these projects might help: + +- For Jest support, see https://www.npmjs.com/package/jest-css-modules-transform (one of a few options). +- For Webpack configuration, see https://webpack.js.org/loaders/css-loader/#pure-css-css-modules-and-postcss for an example. + ## Installation To install with Yarn: @@ -54,6 +71,8 @@ Once installed, add this plugin to your `tsconfig.json`: If you're using Visual Studio Code, please also follow these [instructions](#visual-studio-code). +As Webpack configurations vary, you may need to provide additional [options](#options) to this plugin to match your project configuration. For Create React App users, this plugin will work without additional configuration. + ### Importing CSS A default export is always provided for your CSS module.