fix: throw error when server compile failed (#6508)

This commit is contained in:
ClarkXia 2023-09-05 15:23:07 +08:00 committed by GitHub
parent 68f19eaeab
commit 7194c75c0e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 2 deletions

View File

@ -0,0 +1,5 @@
---
'@ice/app': patch
---
fix: throw error when server compile failed

View File

@ -41,7 +41,10 @@ async function build(options: BuildOptions) {
if (isSuccessful) {
const outputDir = rspackConfigs[0].output.path;
const { serverEntry } = await extendsPluginAPI.serverCompileTask.get() || {};
const { serverEntry, error } = await extendsPluginAPI.serverCompileTask.get() || {};
if (error) {
throw new Error('Build failed, please check the error message.');
}
const outputPaths = await getOutputPaths({
rootDir,
serverEntry,

View File

@ -52,7 +52,10 @@ async function build(
if (isSuccessful) {
// Generate html when SSG.
const outputDir = webpackConfigs[0].output.path;
const { serverEntry } = await extendsPluginAPI.serverCompileTask.get() || {};
const { serverEntry, error } = await extendsPluginAPI.serverCompileTask.get() || {};
if (error) {
throw new Error('Build failed, please check the error message.');
}
const outputPaths = await getOutputPaths({
rootDir,
serverEntry,