Skip to content

Commit 1ef17d0

Browse files
authored
fix(language-core): generate style modules type as needed (#4953)
1 parent 5467277 commit 1ef17d0

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

packages/language-core/lib/codegen/script/styleModulesType.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export function* generateStyleModulesType(
99
ctx: ScriptCodegenContext
1010
): Generator<Code> {
1111
const styles = options.sfc.styles.map((style, i) => [style, i] as const).filter(([style]) => style.module);
12-
if (!styles.length) {
12+
if (!styles.length && !options.scriptSetupRanges?.cssModules.length) {
1313
return;
1414
}
1515
yield `type __VLS_StyleModules = {${newLine}`;
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<script lang="ts" setup>
2+
import { useCssModule } from 'vue';
3+
4+
// @ts-expect-error
5+
useCssModule();
6+
</script>

0 commit comments

Comments
 (0)