From 9158e4d0ff3abe2be880500a496a7b4ac4d75903 Mon Sep 17 00:00:00 2001 From: mizdra Date: Sun, 11 Jan 2026 23:40:28 +0900 Subject: [PATCH] feat(ts-plugin): disable ts-plugin if `cmkConfig.enabled` is `false` --- .changeset/gentle-friends-occur.md | 5 +++++ packages/ts-plugin/src/index.cts | 4 ++++ 2 files changed, 9 insertions(+) create mode 100644 .changeset/gentle-friends-occur.md diff --git a/.changeset/gentle-friends-occur.md b/.changeset/gentle-friends-occur.md new file mode 100644 index 00000000..83a55fd8 --- /dev/null +++ b/.changeset/gentle-friends-occur.md @@ -0,0 +1,5 @@ +--- +'@css-modules-kit/ts-plugin': minor +--- + +feat: disable ts-plugin if `cmkConfig.enabled` is `false` diff --git a/packages/ts-plugin/src/index.cts b/packages/ts-plugin/src/index.cts index e81fe467..8daf802a 100644 --- a/packages/ts-plugin/src/index.cts +++ b/packages/ts-plugin/src/index.cts @@ -40,6 +40,10 @@ const plugin = createLanguageServicePlugin((ts, info) => { } } + if (config.enabled === false) { + return { languagePlugins: [] }; + } + // tsserver should report a “Cannot find module” error for import statements in CSS Modules that // do not exist. However, if `dtsOutDir` is included in `rootDirs` and old .d.ts files remain // in `dtsOutDir`, the error will not be reported. Therefore, remove `dtsOutDir` from `rootDirs`.