diff --git a/.changeset/clever-ducks-wave.md b/.changeset/clever-ducks-wave.md new file mode 100644 index 000000000000..e1773095058d --- /dev/null +++ b/.changeset/clever-ducks-wave.md @@ -0,0 +1,5 @@ +--- +'@sveltejs/kit': patch +--- + +[fix] set Vite base URL diff --git a/packages/kit/src/exports/vite/index.js b/packages/kit/src/exports/vite/index.js index 51995ef87bba..e4fabf7871d5 100644 --- a/packages/kit/src/exports/vite/index.js +++ b/packages/kit/src/exports/vite/index.js @@ -253,7 +253,7 @@ function kit({ svelte_config }) { /** @type {import('vite').UserConfig} */ const result = { appType: 'custom', - base: './', + base: svelte_config.kit.paths.base, build: { rollupOptions: { // Vite dependency crawler needs an explicit JS entry point diff --git a/packages/kit/src/exports/vite/utils.js b/packages/kit/src/exports/vite/utils.js index 4496c1408198..1d040ff31990 100644 --- a/packages/kit/src/exports/vite/utils.js +++ b/packages/kit/src/exports/vite/utils.js @@ -173,8 +173,12 @@ export function not_found(req, res, base) { if (type === 'text/html') { res.setHeader('Content-Type', 'text/html'); - res.end(`Not found (did you mean ${prefixed}?)`); + res.end( + `The server is configured with a public base URL of /path-base - did you mean to visit ${prefixed} instead?` + ); } else { - res.end(`Not found (did you mean ${prefixed}?)`); + res.end( + `The server is configured with a public base URL of /path-base - did you mean to visit ${prefixed} instead?` + ); } } diff --git a/packages/kit/test/apps/options/source/template.html b/packages/kit/test/apps/options/source/template.html index 5b4fa5d89d58..3a12690637fb 100644 --- a/packages/kit/test/apps/options/source/template.html +++ b/packages/kit/test/apps/options/source/template.html @@ -9,6 +9,6 @@