Skip to content
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(svelte5): enable hmr #836

Merged
merged 9 commits into from Apr 10, 2024
Merged

feat(svelte5): enable hmr #836

merged 9 commits into from Apr 10, 2024

Conversation

dominikg
Copy link
Member

enable support for the upcoming native hmr support in svelte5

cc @rixo

@trueadm
Copy link
Collaborator

trueadm commented Apr 9, 2024

Just looking at this, we need to possibly avoid some other call-sites for Svelte 5:

@dominikg
Copy link
Member Author

dominikg commented Apr 9, 2024

the goal is that we have a new compile option for svelte5 like compileOptions.hmr, and don't use vitePlugin.hot at all anymore. It being forced to false leads to svelte-hmr being unused so we don't need all of the code for that anymore..

Which brings us to the next step that follows around rc release of svelte5, a new vite plugin svelte major that removes all of the code only required for svelte4, including removal of svelte-hmr as a dep.
This would also allow us to introduce svelte5 specific hmr handling in v-p-s but ideally we just pass the option through so that other bundler plugins can reuse it. For my current point of view import.meta.hot by vite is the closest thing to a standard we have in that area and any new bundlers/implementations for it would probably be based on that.

@rixo knows more about the history between divergences in snowpack, vite and nollup.

potentially different apis would be webpack https://webpack.js.org/api/hot-module-replacement/ and turbopack ?! the question is if you want to deal with these on the compiler level or if you want the bundler plugin to give you an adapter like svelte-hmr did in createMakeHot?

@dominikg
Copy link
Member Author

dominikg commented Apr 9, 2024

this early return needs to be changed in this PR before it actually works

package.json Outdated Show resolved Hide resolved
Co-authored-by: Conduitry <git@chor.date>
@dominikg
Copy link
Member Author

do we have to check a minimum svelte5 version to avoid it breaking for users on previous alphas?

@trueadm
Copy link
Collaborator

trueadm commented Apr 10, 2024

@dominikg If they are on previous alphas, compilerOptions.hmr will just say the option isn't supported, prompting them to update.

@trueadm trueadm marked this pull request as ready for review April 10, 2024 10:56
@dominikg dominikg merged commit f12e3f0 into main Apr 10, 2024
5 checks passed
@dominikg dominikg deleted the feat/svelte5-hmr branch April 10, 2024 19:42
@github-actions github-actions bot mentioned this pull request Apr 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants