Skip to content

Commit aaeeddb

Browse files
authored
fix(vite): fix windows path separator for static copy targets (#11048)
1 parent 9769107 commit aaeeddb

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

packages/vite/configuration/base.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,10 +230,11 @@ export const baseConfig = ({ mode, flavor }: { mode: string; flavor?: string }):
230230
const fontsDir = resolveFromAppRoot('fonts');
231231
const staticCopyTargets = [];
232232
if (existsSync(assetsDir)) {
233-
staticCopyTargets.push({ src: `${assetsDir}/**/*`, dest: 'assets' });
233+
// Replace \ with / to avoid issues with glob in windows
234+
staticCopyTargets.push({ src: `${assetsDir}/**/*`.replace(/\\/g,'/'), dest: 'assets' });
234235
}
235236
if (existsSync(fontsDir)) {
236-
staticCopyTargets.push({ src: `${fontsDir}/**/*`, dest: 'fonts' });
237+
staticCopyTargets.push({ src: `${fontsDir}/**/*`.replace(/\\/g,'/'), dest: 'fonts' });
237238
}
238239

239240
let disableOptimizeDeps = false;

0 commit comments

Comments
 (0)