Skip to content

Commit 67b5664

Browse files
fix: more robust remote function code transformation (#14418)
* fix: more robust remote function code transformation * Update packages/kit/src/exports/vite/index.js Co-authored-by: Simon H <[email protected]> --------- Co-authored-by: Simon H <[email protected]>
1 parent 4d96559 commit 67b5664

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

.changeset/puny-dancers-smell.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 function code transformation

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

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

804804
fs.writeFileSync(
805805
file,
806-
code.replace('$$_export_$$($$_self_$$)', () => `export default $$_self_$$;`)
806+
// build process might have minified/adjusted the $$_self_$$ variable, but not the fake global $$_export_$$ function
807+
code.replace(/\$\$_export_\$\$\((.+?)\)/, (_, name) => `export default ${name};`)
807808
);
808809
}
809810
}

0 commit comments

Comments
 (0)