Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add env var to disable plugin #244

Merged
merged 4 commits into from
Feb 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 6 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Loading