Open
Description
Description
As a developer using Vite in development mode, I want to configure the prefix used to generate the import paths separately from the prefix used by the dev server, so that I can run Vite in dev mode in a scenario with a reverse proxy that forwards traffic to different applications based on a URL prefix but removes that prefix when forwarding the request.
Currently, I can only set base
in the Vite config which will apply both to the prefix used by the dev server and to the import paths.
Suggested solution
Add an option server.base
that can override the shared base
option. With this, we could do:
import { defineConfig } from "vite";
export default defineConfig({
base: "/foo/",
server: {
base: "/",
},
});
Alternative
Alternatively, the overriding option could be added as build.base
:
import { defineConfig } from "vite";
export default defineConfig({
build: {
base: "/foo/",
},
});
Additional context
No response
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that request the same feature to avoid creating a duplicate.