-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
Describe the bug
Basically, we have this svelte.config.js.
import adapter from '@sveltejs/adapter-node';
const config = {
kit: {
adapter: adapter(),
paths: {
base: '/basepath'
},
}
};
export default config;When we now run svelte-kit build, it produces this folder structure (partly):
build
client
_app
...
server
...
static
...
the problem now is that the browser is not able to fetch the files in client and static. The node server returns status code 404 for these files.
The browser requests the files like this: http://localhost:3000/basepath/_app/....
If we manually modify the folder structure to this (manually add a basepath folder in client and static) it works fine.
build
client
basepath
_app
...
server
...
static
basepath
...
It seems that the adapter-node forgets to take paths.base into account for the static files.
By the way: If I start the build with svelte-kit preview, it works fine. Just starting it with node build does not work.
Reproduction
I created a simple demo app based on the npm init svelte@next command.
https://github.com/vekunz/svelte-paths-base-demo
Logs
basepath:1 GET http://localhost:3000/basepath 404 (Not Found)
basepath:9 GET http://localhost:3000/basepath/_app/assets/pages/__layout.svelte-ace81755.css net::ERR_ABORTED 404 (Not Found)
basepath:10 GET http://localhost:3000/basepath/_app/start-5dffe62e.js net::ERR_ABORTED 404 (Not Found)
basepath:19 GET http://localhost:3000/basepath/_app/assets/svelte-logo-87df40b8.svg 404 (Not Found)
basepath:13 GET http://localhost:3000/basepath/_app/error.svelte-bf7b1a86.js net::ERR_ABORTED 404 (Not Found)
basepath:11 GET http://localhost:3000/basepath/_app/chunks/vendor-ee294e9e.js net::ERR_ABORTED 404 (Not Found)
basepath:12 GET http://localhost:3000/basepath/_app/pages/__layout.svelte-1bb88ece.js net::ERR_ABORTED 404 (Not Found)System Info
System:
OS: Windows 10 10.0.18363
CPU: (12) x64 Intel(R) Core(TM) i7-9850H CPU @ 2.60GHz
Memory: 16.61 GB / 31.79 GB
Binaries:
Node: 14.18.1 - C:\Program Files\nodejs\node.EXE
npm: 6.14.15 - C:\Program Files\nodejs\npm.CMD
Browsers:
Chrome: 97.0.4692.99
Edge: Spartan (44.18362.1593.0)
Internet Explorer: 11.0.18362.1766
npmPackages:
@sveltejs/adapter-auto: next => 1.0.0-next.17
@sveltejs/adapter-node: ^1.0.0-next.67 => 1.0.0-next.67
@sveltejs/kit: next => 1.0.0-next.260
svelte: ^3.46.0 => 3.46.4Severity
blocking all usage of SvelteKit
Additional Information
It seems that in my example app moving the static files in a basepath subdirectory does not work also.