diff --git a/packages/kit/src/exports/vite/index.js b/packages/kit/src/exports/vite/index.js index e6521e979560..fd18f256d2f0 100644 --- a/packages/kit/src/exports/vite/index.js +++ b/packages/kit/src/exports/vite/index.js @@ -125,10 +125,14 @@ const warning_preprocessor = { /** * Returns the SvelteKit Vite plugins. + * @param {{ root: string }} config * @returns {Promise} */ -export async function sveltekit() { - const svelte_config = await load_config(); +export async function sveltekit(config) { + const options = { + cwd: config.root ? config.root : process.cwd(); + }; + const svelte_config = await load_config(options); /** @type {import('@sveltejs/vite-plugin-svelte').Options['preprocess']} */ let preprocess = svelte_config.preprocess;