Skip to content

Commit dcddc33

Browse files
authored
fix: more robust remote file pattern matching (#14578)
Prevents "is this a remote file"-false-negatives which can occur during dev when an ID has a version hash, e.g. `/foo/bar.remote.js?v=123`, which in turn meant the remote file wasn't transformed and the server version ended up on the client
1 parent 4961d4c commit dcddc33

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

.changeset/pretty-snails-take.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@sveltejs/kit': patch
3+
---
4+
5+
fix: more robust remote file pattern matching

packages/kit/src/exports/vite/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,8 @@ async function kit({ svelte_config }) {
697697
},
698698

699699
async transform(code, id, opts) {
700-
if (!svelte_config.kit.moduleExtensions.some((ext) => id.endsWith(`.remote${ext}`))) {
700+
const normalized = normalize_id(id, normalized_lib, normalized_cwd);
701+
if (!svelte_config.kit.moduleExtensions.some((ext) => normalized.endsWith(`.remote${ext}`))) {
701702
return;
702703
}
703704

0 commit comments

Comments
 (0)