-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
fix: avoid concealing build errors #5520
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
🦋 Changeset detectedLatest commit: 681d785 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
cb9df3b
to
681d785
Compare
This feels like quite a bit of complexity. IIRC the reason we're not doing the adapt step inside |
I had wondered as well and #5306 would certainly be nice to fix given the number of issues it has caused, but I think the answer is that we still need this because what would it mean to run the adapter on a failed build? I talked with patak that we need additional hooks at the end of the Vite build, so I think that may be part of the answer long-term as well |
If adapting was part of |
Yes, but it would break Vite plugins that output anything during |
Ah, I see. What does that mean in practice though? Are there any adapters that depend on the output of a Vite plugin? Even if so, it feels like all that would need to happen is that the SvelteKit plugin goes after any plugins that generate output the adapter depends on. |
It's not really specific to any adapter. E.g.
Unfortunately not because all |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
given that we're not using the actual values of build_error
or write_bundle_error
anywhere, can we just track it as a boolean? suggestions inline
/** @type {Error | undefined} */ | ||
let build_error; | ||
|
||
/** @type {Error | undefined} */ | ||
let write_bundle_error; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/** @type {Error | undefined} */ | |
let build_error; | |
/** @type {Error | undefined} */ | |
let write_bundle_error; | |
let errored = false; |
@@ -247,6 +253,9 @@ function kit() { | |||
* Clears the output directories. | |||
*/ | |||
buildStart() { | |||
// Reset errors in watch mode | |||
build_error = write_bundle_error = undefined; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
build_error = write_bundle_error = undefined; | |
errored = false; |
@@ -256,6 +265,10 @@ function kit() { | |||
} | |||
}, | |||
|
|||
buildEnd(err) { | |||
build_error = err; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
build_error = err; | |
errored = !!err; |
|
||
await build_service_worker(options, prerendered, client.vite_manifest); | ||
} catch (error) { | ||
throw (write_bundle_error = /** @type {Error} */ (error)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
throw (write_bundle_error = /** @type {Error} */ (error)); | |
errored = true; | |
throw (error); |
@@ -354,6 +373,11 @@ function kit() { | |||
if (!is_build) { | |||
return; // vite calls closeBundle when dev-server restarts, ignore that | |||
} | |||
|
|||
if (build_error || write_bundle_error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (build_error || write_bundle_error) { | |
if (errored) { |
in fact, could we make it even simpler than my suggestion above? rather than tracking failure, we could track success. presumably |
* 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>
closing since #5536 was merged — thanks all |
closes #5413
Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
Tests
pnpm test
and lint the project withpnpm lint
andpnpm check
Changesets
pnpm changeset
and following the prompts. All changesets should bepatch
until SvelteKit 1.0