Closed helluvamatt closed 10 months ago
Hi, should all entries use full url or just the vite client script? To make HMR work
I would use the full Vite server URL for all assets and scripts, so that you don't need the middleware at all. With my library, I planned on having a tag helper do pretty much all of the work.
Hello, I'm sorry for the delay. You are completely right. HMR works correctly using the entire Vite development server uri. Thank you very much!!!
For now I will make the change so that the vite client script always uses the full URL. After doing a few more tests I will add the option to prefer the full URL when generated with Tag Helpers.
Hi. I added a new option to use The full dev server url v1.10.2
If it is enable, the Tag Helpers will use the full URL like https://localhost:5173/main.ts
instead of just /main.ts
.
Hi, i'll close this issue. With 4a2a47a31e6cdf471ab25f4f442ece3dca277941, Tag helpers will use always the dev server url. And also the middleware mode is optional.
This issue describes a proposal for a non-proxy development mode that allows the tag helpers to simply print out development URLs directly to the Vite Dev Server. (Eg.
<script type="module" src="https://localhost:4173/src/main.ts"></script>
)Currently, the proxy middleware does not support hot module reload (HMR), because this feature requires a websocket to be connected to Vite. HMR could be supported by simply having the browser connect directly to the Vite dev server.
Cross-origin resource sharing (CORS) would need to be discussed. I believe the Vite dev server supports CORS by simply allowing all requests from all origins.
This is the approach I was planning in my library (https://github.com/helluvamatt/ViteIntegration). However, I do not have the time to maintain my own library, so I may deprecate it and direct users to this library.