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 am trying to set a base path for my Vite app (I need this when deploying to GitLab Pages as it is of the form: https://<username>.gitlab.io/<projectname>. if I omit the base path it expects everything to be at https://<username>.gitlab.io, which doesn't work). When I set the base path everything works except static assets stored in /public. They omit the base path set. For example, what should be: /<basepath>/vite.svg is just /vite.svg when built and run in preview with npm run build && npm run preview.
Run npm run build && npm run preview .
Append the base path to the url in the preview window. Ex. https://vitejs-vite-<id>.local.webcontainer.io -> https://vitejs-vite-<id>.local.webcontainer.io/<baseURL>
Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to vuejs/core instead.
Describe the bug
I am trying to set a base path for my Vite app (I need this when deploying to GitLab Pages as it is of the form:
https://<username>.gitlab.io/<projectname>
. if I omit the base path it expects everything to be athttps://<username>.gitlab.io
, which doesn't work). When I set the base path everything works except static assets stored in/public
. They omit the base path set. For example, what should be:/<basepath>/vite.svg
is just/vite.svg
when built and run in preview withnpm run build && npm run preview
.My
vite.config.ts
looks like this:Reproduction
https://stackblitz.com/edit/vitejs-vite-ewfdb6?file=vite.config.js
Steps to reproduce
Run
npm run build && npm run preview
.Append the base path to the url in the preview window. Ex.
https://vitejs-vite-<id>.local.webcontainer.io
->https://vitejs-vite-<id>.local.webcontainer.io/<baseURL>
System Info
Used Package Manager
npm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: