Skip to content

Commit c60659e

Browse files
committed
chore: include vite windows plugin only when running on windows
1 parent 4ee8872 commit c60659e

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

packages/docs/build/windows.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
import { createFilter } from 'vite'
22
import type { Plugin } from 'vite'
3+
import process from 'node:process'
4+
5+
export function Windows (include: RegExp[]) {
6+
if (process.platform !== 'win32') {
7+
return undefined
8+
}
39

4-
export function Windows (include = [/\.vue$/, /\.vue\?vue/, /\.md$/, /\.md\?vue/]) {
510
const filter = createFilter(include)
611
return {
712
name: 'vuetify:windows',

packages/docs/vite.config.mts

+5-3
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ import { genAppMetaInfo } from './src/utils/metadata'
2424
import { MdiJs } from './build/mdi-js'
2525
import { Windows } from './build/windows'
2626

27+
const componentsInclude = [/\.vue$/, /\.vue\?vue/, /\.md$/, /\.md\?vue/]
28+
2729
const resolve = (file: string) => fileURLToPath(new URL(file, import.meta.url))
2830

2931
const ssrTransformCustomDirective = () => {
@@ -134,7 +136,7 @@ export default defineConfig(({ command, mode, isSsrBuild }) => {
134136
// https://github.com/antfu/unplugin-vue-components
135137
Components({
136138
directoryAsNamespace: true,
137-
include: [/\.vue$/, /\.vue\?vue/, /\.md$/, /\.md\?vue/],
139+
include: componentsInclude,
138140
exclude: [],
139141
excludeNames: ['AppMarkdown'],
140142
}),
@@ -277,7 +279,7 @@ export default defineConfig(({ command, mode, isSsrBuild }) => {
277279
styles: command === 'serve' || mode === 'development' ? 'sass' : true,
278280
}),
279281

280-
Windows(),
282+
Windows(componentsInclude),
281283

282284
// https://github.com/intlify/bundle-tools/tree/main/packages/vite-plugin-vue-i18n
283285
VueI18n({
@@ -352,7 +354,7 @@ export default defineConfig(({ command, mode, isSsrBuild }) => {
352354
Inspect(),
353355

354356
process.env.HTTPS === 'true' ? basicSsl() : undefined,
355-
],
357+
].filter(Boolean),
356358

357359
optimizeDeps: {
358360
include: [

0 commit comments

Comments
 (0)