diff --git a/packages/language-core/lib/codegen/script/styleModulesType.ts b/packages/language-core/lib/codegen/script/styleModulesType.ts index 8ddd9b89fb..f23a7addfa 100644 --- a/packages/language-core/lib/codegen/script/styleModulesType.ts +++ b/packages/language-core/lib/codegen/script/styleModulesType.ts @@ -9,7 +9,7 @@ export function* generateStyleModulesType( ctx: ScriptCodegenContext ): Generator { const styles = options.sfc.styles.map((style, i) => [style, i] as const).filter(([style]) => style.module); - if (!styles.length) { + if (!styles.length && !options.scriptSetupRanges?.cssModules.length) { return; } yield `type __VLS_StyleModules = {${newLine}`; diff --git a/test-workspace/tsc/passedFixtures/vue3/cssModule/empty.vue b/test-workspace/tsc/passedFixtures/vue3/cssModule/empty.vue new file mode 100644 index 0000000000..cd1d21d462 --- /dev/null +++ b/test-workspace/tsc/passedFixtures/vue3/cssModule/empty.vue @@ -0,0 +1,6 @@ + \ No newline at end of file