From 7a7f9089d33a93b21366fd26b79cac9d501ebae5 Mon Sep 17 00:00:00 2001 From: dominikg Date: Wed, 28 Apr 2021 22:11:08 +0200 Subject: [PATCH] fix: use pathToFileURL to ensure windows compatibility see https://github.com/sveltejs/vite-plugin-svelte/issues/29#issuecomment-828218723 --- packages/vite-plugin-svelte/src/utils/loadSvelteConfig.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/vite-plugin-svelte/src/utils/loadSvelteConfig.ts b/packages/vite-plugin-svelte/src/utils/loadSvelteConfig.ts index 383ee3c9f..07721ab17 100644 --- a/packages/vite-plugin-svelte/src/utils/loadSvelteConfig.ts +++ b/packages/vite-plugin-svelte/src/utils/loadSvelteConfig.ts @@ -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'; @@ -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;