-
-
Notifications
You must be signed in to change notification settings - Fork 6.1k
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
HMR path is not used for serving assets #16595
Comments
Hello @ionut-mihalache. Please provide a minimal reproduction using a GitHub repository or StackBlitz. Issues marked with |
I added a very simple example at https://stackblitz.com/edit/vitejs-vite-7xkluq?file=vite.config.js. I expect /custom/path to be visible and used when serving assets. It is ok to expect this or is there some other setting that I am missing. In this example if we look at client in the network tab, we find this https://vitejsvite7xkluq-1ecl--5173--34455753.local-credentialless.webcontainer.io/@vite/client. I would expect to be something like this https://vitejsvite7xkluq-1ecl--5173--34455753.local-credentialless.webcontainer.io//custom/path/@vite/client in my case. I know about the base option, but I want to use that for production builds and not for development. |
Start a new pull request in StackBlitz Codeflow. |
What is the reason for that? |
How can I see this is the case? Neither the hot file or the network tab in the browser reflect this. The files seem to be served from the root path and that leads to NOT_FOUND error.
I tried to use the base option but it seems like it is not working because in production the expectation is that the asset directory is the build directory, so in this case I would set the base to /custom/path/build/; this works in production ( If you say that is possible to get the expected behavior at the moment, then what is the proper way to 'force' the development server to serve me the assets from my custom path. The documentation is not quite clear about this (maybe this is too particular but I don't think that it is uncommon to have a site at a domain path, not at the root domain). Or put more simply, what is the option to change the hot file contents from something like Thank you. |
You can see it in the network tab of dev tools.
I don't get what you mean by "hot file". But setting export default defineConfig(({ command }) => ({
base: command === 'serve' ? '/custom/path/' : '/custom/path/build/'
})) |
When running So the question is if there is a way to change the contents of that created file called hot from the |
Vite doesn't generate a file named |
Ok, thank you for your help. I am using Laravel, but I did not know that the plugin creates the hot file. I will open an issue on the Laravel Vite Plugin git repo. |
Describe the bug
I have a remote server that I use for development. The servers runs the Vite dev server. I want Vite to serve assets from mydomain.com/mypath.
This is what I have in vite.config.js: hmr: { host: "mydomain.com", path: "mypath" }. The hot file still has http://mydomain.com:5173. If I manually change the hot file and add the path it works as intended as the files are served from http://mydomain.com:5173/mypath.
I tried to put path with '/' and w/o '/' but still the same result. Is it intended to manually change the hot file?
For reproduction I linked an older issue that seems to solve the problem but it still manifests.
Thanks.
Reproduction
#1705
Steps to reproduce
Added a very simple example at https://stackblitz.com/edit/vitejs-vite-7xkluq?file=vite.config.js. I expect /custom/path to be visible and used when serving assets. It is ok to expect this or is there some other setting that I am missing.
In this example if we look at client in the network tab, we find this https://vitejsvite7xkluq-1ecl--5173--34455753.local-credentialless.webcontainer.io/@vite/client. I would expect to be something like this https://vitejsvite7xkluq-1ecl--5173--34455753.local-credentialless.webcontainer.io//custom/path/@vite/client in my case.
This issue seems to be fixed as of this issue but the problem still seems to manifest for me.
System Info
Used Package Manager
npm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: