Kokodoko
Kokodoko

Reputation: 28138

How can I configure Vite to work with relative paths?

I would like to build my static HTML site in a DIST folder that works regardless of the directory that it's placed in. I am using Vite to build the project. I use base to tell Vite where the project is:

package.json:

    "scripts": {
        "dev": "vite",
        "build": "vite build --base=/~henk/projects/myproject/dist/"
    },

This works, but now my static website can only be opened while the project is exactly in localhost/~henk/projects/myproject/dist/

If I move the project files to another folder, it stops working. If I want to publish to github pages, I have to remember to manually change the base every time.

Is there a way to make Vite use relative paths?

Upvotes: 1

Views: 4416

Answers (0)

Related Questions