Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/neat-monkeys-dream.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/kit': patch
---

[fix] support vite.config.js on Windows
5 changes: 3 additions & 2 deletions packages/kit/src/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import path from 'path';
import colors from 'kleur';
import sade from 'sade';
import * as vite from 'vite';
import { load_config } from './core/config/index.js';
import { networkInterfaces, release } from 'os';
import { pathToFileURL } from 'url';
import { load_config } from './core/config/index.js';
import { coalesce_to_error } from './utils/error.js';

/** @param {unknown} e */
Expand Down Expand Up @@ -289,7 +290,7 @@ export async function get_vite_config(svelte_config) {
for (const file of ['vite.config.js', 'vite.config.mjs', 'vite.config.cjs']) {
if (fs.existsSync(file)) {
// TODO warn here if config.kit.vite was specified
const module = await import(path.resolve(file));
const module = await import(pathToFileURL(file).toString());
return {
...module.default,
configFile: false
Expand Down
12 changes: 0 additions & 12 deletions packages/kit/test/apps/options-2/svelte.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import * as path from 'path';

/** @type {import('@sveltejs/kit').Config} */
const config = {
kit: {
Expand All @@ -8,16 +6,6 @@ const config = {
},
serviceWorker: {
register: false
},
vite: {
server: {
// TODO: required to support ipv6, remove on vite 3
// https://github.com/vitejs/vite/issues/7075
host: 'localhost',
fs: {
allow: [path.resolve('../../../src')]
}
}
}
}
};
Expand Down
17 changes: 17 additions & 0 deletions packages/kit/test/apps/options-2/vite.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import * as path from 'path';
import { sveltekit } from '@sveltejs/kit/experimental/vite';

/** @type {import('vite').UserConfig} */
const config = {
plugins: [sveltekit()],
server: {
// TODO: required to support ipv6, remove on vite 3
// https://github.com/vitejs/vite/issues/7075
host: 'localhost',
fs: {
allow: [path.resolve('../../../src')]
}
}
};

export default config;