Skip to content

Commit

Permalink
fix: skip closeBundle hook during dev to prevent errors on restart (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
dominikg authored Jul 11, 2022
1 parent 578a288 commit 59d03e2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/chilled-moons-sniff.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/kit': patch
---

skip closeBundle hook during dev to prevent errors on restart
5 changes: 4 additions & 1 deletion packages/kit/src/vite/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,9 @@ function kit() {
},

async closeBundle() {
if (!is_build) {
return; // vite calls closeBundle when dev-server restarts, ignore that
}
if (svelte_config.kit.adapter) {
const { adapt } = await import('../core/adapt/index.js');
await adapt(svelte_config, build_data, prerendered, { log });
Expand All @@ -336,7 +339,7 @@ function kit() {
);
}

if (is_build && svelte_config.kit.prerender.enabled) {
if (svelte_config.kit.prerender.enabled) {
// this is necessary to close any open db connections, etc.
// TODO: prerender in a subprocess so we can exit in isolation
// https://github.com/sveltejs/kit/issues/5306
Expand Down

0 comments on commit 59d03e2

Please sign in to comment.