diff --git a/packages/next-swc/crates/next-build/src/next_build.rs b/packages/next-swc/crates/next-build/src/next_build.rs index a3eb7a637b40c..fcb49a6e4d1b5 100644 --- a/packages/next-swc/crates/next-build/src/next_build.rs +++ b/packages/next-swc/crates/next-build/src/next_build.rs @@ -35,7 +35,7 @@ use turbopack_binding::{ asset::Asset, chunk::ChunkingContext, environment::ServerAddr, - issue::{IssueContextExt, IssueReporter, IssueSeverity}, + issue::{handle_issues, IssueContextExt, IssueReporter, IssueSeverity}, output::{OutputAsset, OutputAssets}, virtual_fs::VirtualFileSystem, }, @@ -53,6 +53,8 @@ use crate::{ next_pages::page_entries::{compute_page_entries_chunks, get_page_entries}, }; +static MIN_FAILING_SEVERITY: IssueSeverity = IssueSeverity::Error; + #[turbo_tasks::function] pub(crate) async fn next_build(options: TransientInstance) -> Result> { let project_root = options @@ -149,8 +151,22 @@ pub(crate) async fn next_build(options: TransientInstance) -> Resu next_config, ); - handle_issues(page_entries, issue_reporter).await?; - handle_issues(app_entries, issue_reporter).await?; + handle_issues( + page_entries, + issue_reporter, + MIN_FAILING_SEVERITY.cell(), + None, + None, + ) + .await?; + handle_issues( + app_entries, + issue_reporter, + MIN_FAILING_SEVERITY.cell(), + None, + None, + ) + .await?; let page_entries = page_entries.await?; let app_entries = app_entries.await?; @@ -436,7 +452,14 @@ async fn workspace_fs( issue_reporter: Vc>, ) -> Result>> { let disk_fs = DiskFileSystem::new("workspace".to_string(), workspace_root.to_string()); - handle_issues(disk_fs, issue_reporter).await?; + handle_issues( + disk_fs, + issue_reporter, + MIN_FAILING_SEVERITY.cell(), + None, + None, + ) + .await?; Ok(Vc::upcast(disk_fs)) } @@ -446,7 +469,14 @@ async fn node_fs( issue_reporter: Vc>, ) -> Result>> { let disk_fs = DiskFileSystem::new("node".to_string(), node_root.to_string()); - handle_issues(disk_fs, issue_reporter).await?; + handle_issues( + disk_fs, + issue_reporter, + MIN_FAILING_SEVERITY.cell(), + None, + None, + ) + .await?; Ok(Vc::upcast(disk_fs)) } @@ -456,29 +486,17 @@ async fn client_fs( issue_reporter: Vc>, ) -> Result>> { let disk_fs = DiskFileSystem::new("client".to_string(), client_root.to_string()); - handle_issues(disk_fs, issue_reporter).await?; + handle_issues( + disk_fs, + issue_reporter, + MIN_FAILING_SEVERITY.cell(), + None, + None, + ) + .await?; Ok(Vc::upcast(disk_fs)) } -async fn handle_issues(source: Vc, issue_reporter: Vc>) -> Result<()> { - let issues = source - .peek_issues_with_path() - .await? - .strongly_consistent() - .await?; - - let has_fatal = issue_reporter.report_issues( - TransientInstance::new(issues.clone()), - TransientValue::new(source.node), - ); - - if *has_fatal.await? { - Err(anyhow!("Fatal issue(s) occurred")) - } else { - Ok(()) - } -} - /// Emits all assets transitively reachable from the given chunks, that are /// inside the node root or the client root. async fn emit_all_assets(