From 2e4b6a422d014fccd58d86cf95b5deb13698ff12 Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Sat, 12 Jun 2021 00:48:41 +0800 Subject: [PATCH] fix: windicss scaning for dist vue sfc --- src/defaultTheme/module.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/defaultTheme/module.ts b/src/defaultTheme/module.ts index d0ed7051b..97571ff39 100644 --- a/src/defaultTheme/module.ts +++ b/src/defaultTheme/module.ts @@ -75,10 +75,19 @@ export default function themeSetupModule() { absolute: true }) + const cssFiles = transformFiles.filter((f: string) => f.endsWith('.css')) + const vueFiles = transformFiles.filter((f: string) => f.endsWith('.vue')) + // Make sure file @apply's get transformed windiOptions.scanOptions.extraTransformTargets = { - css: transformFiles.filter((f: string) => f.endsWith('.css')), - detect: transformFiles.filter((f: string) => f.endsWith('.vue')) + css: [ + ...cssFiles, + ...vueFiles.flatMap(i => [ + `${i}?vue&type=style&index=0&scoped=true&lang.postcss`, + `${i}?vue&type=style&index=0&lang.postcss` + ]) + ], + detect: vueFiles } // Push every included path into scan options