Skip to content

Commit

Permalink
Update vite-module-loader.js
Browse files Browse the repository at this point in the history
Fix for #1867 
vite-module-loader.js not working on windows os
  • Loading branch information
elemes1 authored Nov 15, 2024
1 parent 15a9e72 commit 690dea6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion scripts/vite-module-loader.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import fs from 'fs/promises';
import path from 'path';
import { pathToFileURL } from 'url';

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

try {
await fs.access(viteConfigPath);
// Convert to a file URL for Windows compatibility
const moduleConfigURL = pathToFileURL(viteConfigPath);

// Import the module-specific Vite configuration
const moduleConfig = await import(viteConfigPath);
const moduleConfig = await import(moduleConfigURL.href);

if (moduleConfig.paths && Array.isArray(moduleConfig.paths)) {
paths.push(...moduleConfig.paths);
Expand Down

0 comments on commit 690dea6

Please sign in to comment.