-
-
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
feat: use a single transport for fetchModule and HMR support #18362
base: main
Are you sure you want to change the base?
Conversation
Run & review this pull request in StackBlitz Codeflow. |
I polished the interface so that it's more easier to implement for the env providers. I think we need a better name and check if this is not breaking a code that was working in 5.x. |
@bluwy pointed out the inconsistency in the naming of Should we also standardise it here? |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
/ecosystem-ci run |
📝 Ran ecosystem CI on
✅ analogjs, histoire, ladle, laravel, marko, nuxt, previewjs, quasar, qwik, rakkas, redwoodjs, storybook, unocss, vite-plugin-pwa, vite-plugin-react, vite-plugin-react-swc, vite-plugin-svelte, vite-plugin-vue, vite-setup-catalogue, vitepress, vuepress |
I've updated the docs (maybe it should contain a bit more explaination about the HotChannel). It's now ready. This is how the diff looks like after this PR: sapphi-red/daienjo-architecture@804cb53 I'm not going to implement it in this PR, but it would be nice if we can use the default WebSocketServer for multiple envs. For example, using it from the service worker env as well. |
options.hmr.connection.onUpdate(createHMRHandler(this)) | ||
hmrHandlerForTransport = createHMRHandler(this) | ||
if (!this.transport.connect) { | ||
resolvedHmrLogger.error('HMR is not supported by this runner transport') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we throw an error instead? 🤔 If hmr
is provided, then I would assume the transport supports it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
packages/vite/src/node/server/__tests__/pluginContainer.spec.ts
Outdated
Show resolved
Hide resolved
…d check the value
Exported |
Description
so that env providers not need to implement both fetchModule transport and HMR transport.
I think this PR still needs to polish the naming and probably better to introduce a interface that wraps HotChannel so that env providers does not need to care about internal conversion that is done for(done).send
andinvoke
The upper part is how it was before and the lower part is how it is after.