Replies: 1 comment
|
We have the same problem |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Hi,
I want to be able to decouple the vite
baseproperty and the path, the development server uses as "root" to server the assets from.The reason for this is that I am using a reverse proxy in front of the vite development server as well as the production webserver that hosts the built files.
The setup is as follows:
http//localhost/my/app/*tohttp://localhost:1234/*http://localhost:1234My issue now is that it seems that the vite
baseoption is tightly coupled with the development server. This causes the development server to apply thebasepath to it's virtual directory structure.This causes several issues:
baseto/http://localhost:1234/. But when accessing the pagehttp://localhost/my/app/(the reverse proxy), it reaches theindex.htmlfrom the vite development server but all vite fetches (e.g. the request for@vite/clientfails as it tries to reach it viahttp://localhost/@vite/clientinstead ofhttp://localhost/my/app/@vite/clientwhich would be redirected correctly)baseto/my/app/http://localhost:1234/my/app/which is not what I want as now my reverse proxy must be rewriting requests tohttp://localhost:1234/my/app/instead ofhttp://localhost:1234/Is there a way to decouple the vite
baseoption from the virtual file location the development server serves the files from?So that I can say:
http://localhost/my/app/http://localhost:1234/my/app/)?Additionally, for the production build, it should also work. So
hrefs for assets should begin with/my/app/so they can be resolved correctly.Is there any way to achieve this?
My current workaround is to set the
baseto the "frontend" base path, e.g./my/appand adjust the reverse proxy to not rewrite tohttp://localhost:1234/ but instead tohttp://localhost/1234/my/app/` but this has several downsides and requires to change the reverse proxy configuration between development and production builds.All reactions