diff --git a/README.md b/README.md index 9ee3c38..74aade8 100644 --- a/README.md +++ b/README.md @@ -282,6 +282,12 @@ If you're not using Visual Studio Code or are having trouble with the above meth You can include these logs with any issues you open for this project. +### Disabling the plugin + +If you need to temporarily disable this plugin, or disable it for a single user, you can do that by setting the `DISABLE_TS_PLUGIN_CSS_MODULES` environment variable to any value, and then restarting your IDE. + +Note that this doesn't actually disable the plugin, but causes it to bail out early. See PR #244 for more information. + ## About this project This project was inspired by a Create React App [issue](https://github.com/facebook/create-react-app/issues/5677) diff --git a/src/index.ts b/src/index.ts index fd9f3e1..403b863 100644 --- a/src/index.ts +++ b/src/index.ts @@ -21,6 +21,12 @@ const getPostCssConfigPlugins = (directory: string) => { }; const init: tsModule.server.PluginModuleFactory = ({ typescript: ts }) => { + if (process.env.DISABLE_TS_PLUGIN_CSS_MODULES !== undefined) { + return { + create: (info: tsModule.server.PluginCreateInfo) => info.languageService, + }; + } + let _isCSS: isCSSFn; function create(