Error handling bugfix: pass #1
This commit is contained in:
@@ -4,6 +4,8 @@ import { writeFileSync } from "fs";
|
||||
import path from "path";
|
||||
import grabDirNames from "../../../utils/grab-dir-names";
|
||||
import grabRelativePath from "../../../utils/grab-relative-path";
|
||||
import { logBuildErrorsOnce, resetBuildErrorLog, } from "../../../utils/build-error-log";
|
||||
import { log } from "../../../utils/log";
|
||||
let build_start = 0;
|
||||
let build_starts = 0;
|
||||
const MAX_BUILD_STARTS = 2;
|
||||
@@ -23,6 +25,7 @@ export default function ssrCTXArtifactTracker({ entryToPage, post_build_fn, }) {
|
||||
});
|
||||
build.onEnd(async (result) => {
|
||||
if (result.errors.length > 0) {
|
||||
global.BUNEXT_BUILD_FAILED = true;
|
||||
global.BUNEXT_SSR_BUNDLER_CTX_DISPOSED = true;
|
||||
try {
|
||||
await global.BUNEXT_SSR_BUNDLER_CTX?.dispose();
|
||||
@@ -30,9 +33,7 @@ export default function ssrCTXArtifactTracker({ entryToPage, post_build_fn, }) {
|
||||
catch { }
|
||||
global.BUNEXT_SSR_BUNDLER_CTX = undefined;
|
||||
build_starts = 0;
|
||||
for (const err of result.errors) {
|
||||
console.error(`SSR Build error: ${err.text}${err.location ? ` (${err.location.file}:${err.location.line}:${err.location.column})` : ""}`);
|
||||
}
|
||||
logBuildErrorsOnce(result.errors, (line) => log.error(`SSR Build error: ${line}`));
|
||||
return;
|
||||
}
|
||||
const artifacts = grabArtifactsFromBundledResults({
|
||||
@@ -63,6 +64,8 @@ export default function ssrCTXArtifactTracker({ entryToPage, post_build_fn, }) {
|
||||
}
|
||||
catch (error) { }
|
||||
global.BUNEXT_SSR_BUNDLER_CTX_DISPOSED = false;
|
||||
global.BUNEXT_BUILD_FAILED = false;
|
||||
resetBuildErrorLog();
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user