question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Svelte HMR fails to reload page on Windows

See original GitHub issue

Describe the bug SvelteKit fails to reload page when navigate to page through address bar.

Logs

Failed to load resource: the server responded with a status of 404 (Not Found)
client:190 [hmr] Failed to reload D:\Dev\test\src\routes\page.svelte. This could be due to syntax errors or importing non-existent modules. (see errors above)

To Reproduce

  1. npm init svelte@next
  2. create any page in routes (ex. page.svelte)
  3. navigate to this page through address bar
  4. try modify page.svelte content
  5. sveltekit throws error 404 and page is not refresh / reloading.

I am using windows. Maybe it only windows related issue. Someone need check on other os.

Expected behavior

Stacktraces Information about your SvelteKit Installation:

Severity

Additional context

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:3
  • Comments:28 (14 by maintainers)

github_iconTop GitHub Comments

2reactions
DrewRidleycommented, Apr 9, 2021

My solution I used last time no longer seems to work and I have the same bug. Any further investigations would be appreciated.

Screenshot

This screenshot is indicative of some weird path combining, where it tries to combine the local path with the server route. Very strange.

0reactions
secretgspotcommented, Oct 1, 2022

don’t know if it will help further isolation of the problem but for me it was:

SomeComponent.svelte in libs folder, and by mistake I imported it as such;

import SomeComponent from '$lib/someComponent.svelte';

my IDE didn’t say anything and component appeared as it should, but anytime I made changes to it, none were reflected unless I terminated npm run dev and ran it again. the moment I imported it correctly is when issue resolved itself.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Svelte Hot Reloading Issue - Stack Overflow
Svelte 3 doesn't have hot reloading yet, but you could automatically refresh the browser on changes with e.g. the LiveReload Rollup plugin. In ......
Read more >
svelte-hmr - npm
Start using svelte-hmr in your project by running `npm i svelte-hmr`. There are 22 other projects in the npm registry using svelte-hmr.
Read more >
Getting Started with Svelte - Snowpack
Get started with this in-depth tutorial on how to build Svelte applications and websites with Snowpack.
Read more >
Features | Vite
Frameworks with HMR capabilities can leverage the API to provide instant, precise updates without reloading the page or blowing away application state.
Read more >
FAQ • SvelteKit
SvelteKit has HMR enabled by default powered by svelte-hmr. ... A side effect of this approach is that it takes longer to load...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found