Skip to content

Commit b2c992b

Browse files
Rich-Harrisignatiusmbgtm-nayan
authored
Alternative to #5520 (#5536)
* loop over values instead with `Object.values` * missed a closing bracket * avoid concealing build errors * fix comment * changeset * Handle errors in writeBundle * inline comments * track success rather than failure * oops, missing piece Co-authored-by: Ignatius Bagus <ignatius.mbs@gmail.com> Co-authored-by: gtm-nayan <gtmnayan@gmail.com>
1 parent 67e2342 commit b2c992b

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

.changeset/large-seahorses-check.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: don't try adapting if build failed

packages/kit/src/vite/index.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ function kit() {
109109
*/
110110
let paths;
111111

112+
let completed_build = false;
113+
112114
function vite_client_config() {
113115
/** @type {Record<string, string>} */
114116
const input = {
@@ -345,15 +347,20 @@ function kit() {
345347
console.log(
346348
`\nRun ${colors.bold().cyan('npm run preview')} to preview your production build locally.`
347349
);
350+
351+
completed_build = true;
348352
},
349353

350354
/**
351355
* Runs the adapter.
352356
*/
353357
async closeBundle() {
354-
if (!is_build) {
355-
return; // vite calls closeBundle when dev-server restarts, ignore that
358+
if (!completed_build) {
359+
// vite calls closeBundle when dev-server restarts, ignore that,
360+
// and only adapt when build successfully completes.
361+
return;
356362
}
363+
357364
if (svelte_config.kit.adapter) {
358365
const { adapt } = await import('../core/adapt/index.js');
359366
await adapt(svelte_config, build_data, prerendered, { log });

0 commit comments

Comments
 (0)