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
I try to dynamically language-.json's located in the public-directory. If i can not find any, i try to fetch the english-one like this: const response = await fetch("/en.json");
Everything works nice with cross-env DEBUG=vite-ssg:* vite. When running vite-ssg build --mode ssg it builds for client but fails building for server with this:
TypeError: Failed to parse URL from /en.json
at node:internal/deps/undici/undici:12345:11
at async SetLanguage (file:///Y:/02_d/01_repos/01_primabit/landingpage01/.vite-ssg-temp/fkde5vqeqn/main.mjs:66:22) {
[cause]: TypeError: Invalid URL
at new URL (node:internal/url:775:36)
at new Request (node:internal/deps/undici/undici:5853:25)
at fetch (node:internal/deps/undici/undici:10123:25)
at Object.fetch (node:internal/deps/undici/undici:12344:10)
at fetch (node:internal/process/pre_execution:336:27)
at SetLanguage (file:///Y:/02_d/01_repos/01_primabit/landingpage01/.vite-ssg-temp/fkde5vqeqn/main.mjs:66:28) {
code: 'ERR_INVALID_URL',
input: '/en.json'
}
}
Several Questions:
Why is vite-ssg checking URLs? Probably to determine which files to put in the output directory. But If i fetch something from some external API, it would always detect errors as the api might not be up and running??
In this case, it is fetched from the public folder and should not be checked at all
But <ClientOnly> seems to have no effect and was not found..
Why client-only? I like vue to build the frontend. But then i need static files to be hosted on a file server, as the backend might be running in .NET or on Kubernetes and be connected only with API-Calls.
Describe the bug
I try to dynamically language-.json's located in the public-directory. If i can not find any, i try to fetch the english-one like this:
const response = await fetch("/en.json");
Everything works nice with
cross-env DEBUG=vite-ssg:* vite
. When runningvite-ssg build --mode ssg
it builds for client but fails building for server with this:Several Questions:
Reproduction
Please see description
System Info
Used Package Manager
npm
Validations
The text was updated successfully, but these errors were encountered: