-
Notifications
You must be signed in to change notification settings - Fork 137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
vite fix custom base url #2046
base: main
Are you sure you want to change the base?
vite fix custom base url #2046
Conversation
how about making all those URLs relative instead? |
that doesn't work, because website can open at some level deeper. |
Maybe that vendor.js could be removed anyway. And directly import loaderjs in entry point? |
|
But then it would access ./my-page/current-page/asset/some-asset.js ? |
why would it? |
Vite keeps it like that in the output..
|
It's not a module... That's why
|
yes, have it relative to begin with and you don't have an issue ( if there is somewhere I can see this falling short in today's world is the router) but that has problems regardless so you lose nothing by having always relative urls which should be the default as it enables exactly the kind of deploy you mentioned of |
vendor.js has to remain a script, not a module. That's why it continues to exist as a separate thing. All the code in it expects to run in script context. |
639a5b1
to
2d9d790
Compare
i found that this is already done automatically by vite. https://vitejs.dev/guide/build.html#public-base-path |
Reopening. |
73e88a8
to
fbc0bd3
Compare
I would hate for us to re introduce this root url concept in vite world |
1cc0d82
to
3f10875
Compare
i had older code still there. have a look now |
abf932f
to
bc6cfdf
Compare
this is for vite build.
Vite does only prefix base path to known public files. So, they do have to exist.
Which does not work for virtual vendor.js and others
https://github.com/vitejs/vite/blob/fe30349d350ef08bccd56404ccc3e6d6e0a2e156/packages/vite/src/node/plugins/html.ts#L456
also, any custom middleware needs to handle this, since base path can be setup during dev