Skip to content

Commit 0765262

Browse files
authored
Merge pull request #1978 from elemes1/1867-fix-vite-module-windows-os
Update vite-module-loader.js to load vite.config for all modules on windows
2 parents 15a9e72 + 690dea6 commit 0765262

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

scripts/vite-module-loader.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import fs from 'fs/promises';
22
import path from 'path';
3+
import { pathToFileURL } from 'url';
34

45
async function collectModuleAssetsPaths(paths, modulesPath) {
56
modulesPath = path.join(__dirname, modulesPath);
@@ -26,8 +27,11 @@ async function collectModuleAssetsPaths(paths, modulesPath) {
2627

2728
try {
2829
await fs.access(viteConfigPath);
30+
// Convert to a file URL for Windows compatibility
31+
const moduleConfigURL = pathToFileURL(viteConfigPath);
32+
2933
// Import the module-specific Vite configuration
30-
const moduleConfig = await import(viteConfigPath);
34+
const moduleConfig = await import(moduleConfigURL.href);
3135

3236
if (moduleConfig.paths && Array.isArray(moduleConfig.paths)) {
3337
paths.push(...moduleConfig.paths);

0 commit comments

Comments
 (0)