Skip to content

Commit

Permalink
[fix] HMR on Windows (#2315)
Browse files Browse the repository at this point in the history
  • Loading branch information
benmccann authored Aug 29, 2021
1 parent c4a5bb1 commit c3e3b51
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/thin-bats-protect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/kit': patch
---

[fix] HMR on Windows
8 changes: 2 additions & 6 deletions packages/kit/src/core/dev/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ async function create_handler(vite, config, dir, cwd, get_manifest) {
assets: config.kit.paths.assets ? SVELTE_KIT_ASSETS : config.kit.paths.base
},
load_component: async (id) => {
const url = path.resolve(cwd, id);
const url = `/${id}`;

const module = /** @type {SSRComponent} */ (await vite.ssrLoadModule(url));
const node = await vite.moduleGraph.getModuleByUrl(url);
Expand Down Expand Up @@ -430,13 +430,9 @@ async function create_handler(vite, config, dir, cwd, get_manifest) {
}
}

let entry = `/${id}`;
if (!entry.endsWith('.svelte')) {
entry += '?import';
}
return {
module,
entry,
entry: url.endsWith('.svelte') ? url : url + '?import',
css: [],
js: [],
styles: Array.from(styles)
Expand Down

0 comments on commit c3e3b51

Please sign in to comment.