How to build SolidStart with relative base URL?

I have a project I created with a SolidStart TypeScript template, which I'd like to build. I would like all links and navigation in the built to be relative. That is because itch.io doesn't host web pages on domain's root, but on a path like '/html/18718715' with the specific number being unknown in advance. Server-side rendering is not necessary: I need static files for itch.io. How can I achieve this? I tried setting server.baseURL in app.config.ts as '~':
export default defineConfig({
ssr: false,
server: {
baseURL: '~', // '/html/13713015',
},
...
export default defineConfig({
ssr: false,
server: {
baseURL: '~', // '/html/13713015',
},
...
but I get a warning in the console:
(!) "base" option should start with a slash.
As per advices on the internet, as well as LLMs, I tried removing server.baseURL and add vite.base instead:
export default defineConfig({
...
vite: {
base: './',
...
export default defineConfig({
...
vite: {
base: './',
...
but then I get TypeScript error:
Object literal may only specify known properties, and 'base' does not exist in type 'ViteCustomizableConfig | ((options: { router: "server" | "client" | "server-function"; }) => ViteCustomizableConfig)'.
Object literal may only specify known properties, and 'base' does not exist in type 'ViteCustomizableConfig | ((options: { router: "server" | "client" | "server-function"; }) => ViteCustomizableConfig)'.
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?