Skip to content

Commit

Permalink
fix: windicss scaning for dist vue sfc (#412)
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu authored Jun 11, 2021
1 parent c8830b3 commit 4cd4a4e
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/defaultTheme/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,19 @@ export default <Module>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
Expand Down

0 comments on commit 4cd4a4e

Please sign in to comment.