Closed alessandrojcm closed 7 months ago
Hi @alessandrojcm
Now that Vite supports server-side HMR with its new runtime API, are there any plans to modify the plugin to work with this new API?
I know that! I'm planning to make Vite dev-server support the API in the near future.
If not, I would be happy to try implement it; thanks!
Sounds good! You'll be able to do it.
I was thinking a adapter
should include a runtime, for instance, you can use "worked" runtime if you choose Cloudflare adapter. This way makes sense.
https://github.com/honojs/vite-plugins/tree/main/packages/dev-server#adapter-1
Hi @alessandrojcm
Now that Vite supports server-side HMR with its new runtime API, are there any plans to modify the plugin to work with this new API?
I know that! I'm planning to make Vite dev-server support the API in the near future.
If not, I would be happy to try implement it; thanks!
Sounds good! You'll be able to do it.
I was thinking a
adapter
should include a runtime, for instance, you can use "worked" runtime if you choose Cloudflare adapter. This way makes sense.https://github.com/honojs/vite-plugins/tree/main/packages/dev-server#adapter-1
Thanks @yusukebe I will try to give a shot. Just a bit of clarification, you mean the plugin should received an additional runtime parameter? Should the default be vite's runtime? Sorry I am not familiar with worked or Cloudflare in general.
Hi @alessandrojcm
Just a bit of clarification, you mean the plugin should received an additional runtime parameter? Should the default be vite's runtime?
Ideally, it should use the "workerd" runtime if the Cloudflare adapter is used. However, it currently takes a lot of work to get the workerd runtime. You can refer to: https://github.com/sapphi-red/vite-envs/tree/main/packages/cloudflare-pages
Also, runtime providers should provide these runtimes, not what we users extract from them. For example, I believe Cloudflare will provide a runtime for Vite in the future.
So, for now, it is better to use the Vite "default" runtime than to rush into implementation.
In addition, the Runtime API will be renamed the Environment API in v6.0.0 or later and the API will be changed. We will need to follow this change.
https://deploy-preview-16471--vite-docs-main.netlify.app/guide/api-vite-environment.html
Ideally, it should use the "workerd" runtime if the Cloudflare adapter is used. However, it currently takes a lot of work to get the workerd runtime. You can refer to: https://github.com/sapphi-red/vite-envs/tree/main/packages/cloudflare-pages
Also, runtime providers should provide these runtimes, not what we users extract from them. For example, I believe Cloudflare will provide a runtime for Vite in the future.
So, for now, it is better to use the Vite "default" runtime than to rush into implementation.
OK got it, will do that then thanks. In addition, the Runtime API will be renamed the Environment API in v6.0.0 or later and the API will be changed. We will need to follow this change.
https://deploy-preview-16471--vite-docs-main.netlify.app/guide/api-vite-environment.html
Yes I am aware of this change :) will keep an eye on it.
@alessandrojcm
Thanks! This is experimental, but it is worth it for us to challenge it.
So I cloned this on my local, and switched line 103 in dev-server.ts
from ssrLoadModule
to executeEntryPoint
from the Vite runtime and it worked, should I make a PR or am I missing something?
Hi @alessandrojcm
Yes. Can you create a PR?
Now that Vite supports server-side HMR with its new runtime API, are there any plans to modify the plugin to work with this new API? If not, I would be happy to try implement it; thanks!