Skip to content

Commit d42a605

Browse files
committed
fix: disable HMR for Svelte 5
svelte-hmr doesn't support Svelte 5
1 parent c5ecc7b commit d42a605

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,8 @@ Now you can use other languages inside the script and style tags. Make sure to i
213213

214214
### Hot Reload
215215

216+
> Hot Module Reloading is currently not supported for Svelte 5+
217+
216218
This loader supports component-level HMR via the community supported [svelte-hmr](https://github.com/rixo/svelte-hmr) package. This package serves as a testbed and early access for Svelte HMR, while we figure out how to best include HMR support in the compiler itself (which is tricky to do without unfairly favoring any particular dev tooling). Feedback, suggestion, or help to move HMR forward is welcomed at [svelte-hmr](https://github.com/rixo/svelte-hmr/issues) (for now).
217219

218220
Configure inside your `webpack.config.js`:

index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,8 @@ module.exports = function(source, map) {
144144
: handleWarning
145145
);
146146

147-
if (options.hotReload && !isProduction && !isServer) {
147+
// svelte-hmr has no Svelte 5 support
148+
if (options.hotReload && !isProduction && !isServer && getMajor() < 5) {
148149
const hotOptions = { ...options.hotOptions };
149150
const makeHot = buildMakeHot(hotOptions);
150151
const id = JSON.stringify(path.relative(process.cwd(), compileOptions.filename));

0 commit comments

Comments
 (0)