Skip to content

Commit df465eb

Browse files
authored
feat: add env var to disable plugin (#244)
1 parent 8583333 commit df465eb

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,12 @@ If you're not using Visual Studio Code or are having trouble with the above meth
282282

283283
You can include these logs with any issues you open for this project.
284284

285+
### Disabling the plugin
286+
287+
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.
288+
289+
Note that this doesn't actually disable the plugin, but causes it to bail out early. See PR #244 for more information.
290+
285291
## About this project
286292

287293
This project was inspired by a Create React App [issue](https://github.com/facebook/create-react-app/issues/5677)

src/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ const getPostCssConfigPlugins = (directory: string) => {
2121
};
2222

2323
const init: tsModule.server.PluginModuleFactory = ({ typescript: ts }) => {
24+
if (process.env.DISABLE_TS_PLUGIN_CSS_MODULES !== undefined) {
25+
return {
26+
create: (info: tsModule.server.PluginCreateInfo) => info.languageService,
27+
};
28+
}
29+
2430
let _isCSS: isCSSFn;
2531

2632
function create(

0 commit comments

Comments
 (0)