Skip to content

Relative Path in Generated index.html #5081

Answered by fmstuff
miswanting asked this question in Q&A
Discussion options

You must be logged in to vote

How I solved it for my project:

in your vite.config.js you can specify a base field (which defaults to /), and set it to e.g. ./ to produce relative links to assets in your index.html.

Configuring it like this in your vite.config.js should solve your problem:

import { defineConfig } from "vite";

// https://vitejs.dev/config/
export default defineConfig({
  base: "./",
  // your other configuration...
});

See also the Vixe docs for more details: https://vitejs.dev/config/#base

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@saman-waruka
Comment options

Answer selected by miswanting
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants