You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When setting a basepath with kit.paths.base, the prerenderer does not store the prerendered pages and endpoints in the same path, resulting in error when trying to access them.
If basepath is set to /mybasepath, pages will end up in the build/ folder, whereas endpoints will be in build/mybasepath/ folder.
Reproduction
Clone https://github.com/aryga/sveltekit-basepath.git (a minimal project created with create-svelte)
The endpoint and page that are in the same route "mypage" are not prerendered to the same folder.
When you deploy the build folder onto a flat-file server in a folder "myapp", then navigate to the index (is /myapp), then to the myapp/mypage page, it will open with error - it looks for /myapp/mypage/mypage.json when that file is in /myapp/myapp/mypage/mypage.json
Note that dev or preview will work, it somehow finds its way to the file in these modes.
Could not load text from endpoint
Error: Could not load text from endpoint
at H (https://[mysite.com]/myapp/_app/pages/mypage/index.svelte-2a470229.js:1:747)
at async qe._load_node (https://[mysite.com]/myapp/_app/start-e76574a6.js:1:19806)
at async qe._load (https://[mysite.com]/myapp/_app/start-e76574a6.js:1:20635)
at async qe._get_navigation_result (https://[mysite.com]/myapp/_app/start-e76574a6.js:1:18038)
at async qe.update (https://[mysite.com]/myapp/_app/start-e76574a6.js:1:16039)
at async qe.handle_navigation (https://[mysite.com]/myapp/_app/start-e76574a6.js:1:15956)
at async Ce._navigate (https://[mysite.com]/myapp/_app/start-e76574a6.js:1:12353)
Moving build/myapp/mypage/mypage.json to build/mypage/mypage.json fixes the problem.
* Add `base` to builder
* Prepend `builder.base` when copying Client, Static and Prerendered assets in adapter-node
Fixessveltejs#3726
Related sveltejs#3620
Describe the bug
When setting a basepath with kit.paths.base, the prerenderer does not store the prerendered pages and endpoints in the same path, resulting in error when trying to access them.
If basepath is set to /mybasepath, pages will end up in the build/ folder, whereas endpoints will be in build/mybasepath/ folder.
Reproduction
Clone
https://github.com/aryga/sveltekit-basepath.git
(a minimal project created with create-svelte)npm install
npm run build
svelte.config.js contains:
Site structure:
As a result, the prerenderer generates files like this:
The endpoint and page that are in the same route "mypage" are not prerendered to the same folder.
When you deploy the build folder onto a flat-file server in a folder "myapp", then navigate to the index (is /myapp), then to the myapp/mypage page, it will open with error - it looks for /myapp/mypage/mypage.json when that file is in /myapp/myapp/mypage/mypage.json
Note that dev or preview will work, it somehow finds its way to the file in these modes.
Moving build/myapp/mypage/mypage.json to build/mypage/mypage.json fixes the problem.
Logs
No response
System Info
Severity
serious, but I can work around it
Additional Information
Workaround: move the files from build/myapp to build/ when deploying
FYI, I could not get it to work at all with adapter-netlify, myapp/mypage would not load at all but I did not try to check if it was related.
The text was updated successfully, but these errors were encountered: