Skip to content

Commit e5b5204

Browse files
committed
Handle next build error
1 parent 32bc062 commit e5b5204

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

.changeset/many-fans-drum.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"open-next": patch
3+
---
4+
5+
Handle `next build` error

packages/open-next/src/build.ts

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,18 @@ function setStandaloneBuildMode() {
7070
}
7171

7272
function buildNextjsApp(packager: "npm" | "yarn" | "pnpm") {
73-
cp.spawnSync(packager, packager === "npm" ? ["run", "build"] : ["build"], {
74-
stdio: "inherit",
75-
cwd: appPath,
76-
shell: true,
77-
});
73+
const result = cp.spawnSync(
74+
packager,
75+
packager === "npm" ? ["run", "build"] : ["build"],
76+
{
77+
stdio: "inherit",
78+
cwd: appPath,
79+
shell: true,
80+
}
81+
);
82+
if (result.status && result.status !== 0) {
83+
process.exit(1);
84+
}
7885
}
7986

8087
function printHeader(header: string) {

0 commit comments

Comments
 (0)