From 4cd4a4e8b0f782a3c862efa70ce97760a221719b Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Sat, 12 Jun 2021 01:03:35 +0800 Subject: [PATCH] fix: windicss scaning for dist vue sfc (#412) --- 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 724c1803a..26929cf14 100644 --- a/src/defaultTheme/module.ts +++ b/src/defaultTheme/module.ts @@ -83,10 +83,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