Skip to content

Commit

Permalink
fix: use pathToFileURL to ensure windows compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
dominikg committed Apr 28, 2021
1 parent 50b76f8 commit 7a7f908
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/vite-plugin-svelte/src/utils/loadSvelteConfig.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import path from 'path';
import fs from 'fs';
import { pathToFileURL } from 'url';
import { log } from './log';
import { Options } from './options';
import { ResolvedConfig } from 'vite';
Expand All @@ -21,7 +22,7 @@ export async function loadSvelteConfig(
// try to use dynamic import for svelte.config.js first
if (configFile.endsWith('.js') || configFile.endsWith('.mjs')) {
try {
return await dynamicImportDefault(configFile);
return await dynamicImportDefault(pathToFileURL(configFile).href);
} catch (e) {
log.debug(`failed to import config ${configFile}`, e);
err = e;
Expand Down

0 comments on commit 7a7f908

Please sign in to comment.