diff --git a/crates/next-core/src/babel.rs b/crates/next-core/src/babel.rs index c5d8d1d0328dc..95c36bdf935d2 100644 --- a/crates/next-core/src/babel.rs +++ b/crates/next-core/src/babel.rs @@ -3,7 +3,7 @@ use turbo_tasks::{ primitives::{BoolVc, StringVc}, Value, }; -use turbo_tasks_fs::FileSystemPathVc; +use turbo_tasks_fs::{FileSystemEntryType, FileSystemPathVc}; use turbopack::{ module_options::WebpackLoadersOptionsVc, resolve_options, resolve_options_context::ResolveOptionsContext, @@ -37,8 +37,8 @@ pub async fn maybe_add_babel_loader( let has_babel_config = { let mut has_babel_config = false; for filename in BABEL_CONFIG_FILES { - let metadata = project_root.join(filename).metadata().await; - if metadata.is_ok() { + let filetype = *project_root.join(filename).get_type().await?; + if matches!(filetype, FileSystemEntryType::File) { has_babel_config = true; break; } @@ -48,6 +48,7 @@ pub async fn maybe_add_babel_loader( if has_babel_config { let mut options = (*webpack_options.await?).clone(); + let mut has_emitted_babel_resolve_issue = false; for ext in [".js", ".jsx", ".ts", ".tsx", ".cjs", ".mjs"] { let configs = options.extension_to_loaders.get(ext); let has_babel_loader = match configs { @@ -73,7 +74,9 @@ pub async fn maybe_add_babel_loader( }; if !has_babel_loader { - if !*(is_babel_loader_available(project_root).await?) { + if !has_emitted_babel_resolve_issue + && !*is_babel_loader_available(project_root).await? + { BabelIssue { path: project_root, title: StringVc::cell( @@ -88,7 +91,9 @@ pub async fn maybe_add_babel_loader( } .cell() .as_issue() - .emit() + .emit(); + + has_emitted_babel_resolve_issue = true; } let loader = WebpackLoaderConfigItem::LoaderName("babel-loader".to_owned()); diff --git a/crates/next-dev-tests/tests/integration/next/app/metadata/input/app/[slug]/page.tsx b/crates/next-dev-tests/tests/integration/next/app/__flakey__/metadata/input/app/[slug]/page.tsx similarity index 100% rename from crates/next-dev-tests/tests/integration/next/app/metadata/input/app/[slug]/page.tsx rename to crates/next-dev-tests/tests/integration/next/app/__flakey__/metadata/input/app/[slug]/page.tsx diff --git a/crates/next-dev-tests/tests/integration/next/app/metadata/input/app/layout.tsx b/crates/next-dev-tests/tests/integration/next/app/__flakey__/metadata/input/app/layout.tsx similarity index 100% rename from crates/next-dev-tests/tests/integration/next/app/metadata/input/app/layout.tsx rename to crates/next-dev-tests/tests/integration/next/app/__flakey__/metadata/input/app/layout.tsx diff --git a/crates/next-dev-tests/tests/integration/next/app/metadata/input/app/page.tsx b/crates/next-dev-tests/tests/integration/next/app/__flakey__/metadata/input/app/page.tsx similarity index 100% rename from crates/next-dev-tests/tests/integration/next/app/metadata/input/app/page.tsx rename to crates/next-dev-tests/tests/integration/next/app/__flakey__/metadata/input/app/page.tsx diff --git a/crates/next-dev-tests/tests/integration/next/app/metadata/input/app/test.tsx b/crates/next-dev-tests/tests/integration/next/app/__flakey__/metadata/input/app/test.tsx similarity index 100% rename from crates/next-dev-tests/tests/integration/next/app/metadata/input/app/test.tsx rename to crates/next-dev-tests/tests/integration/next/app/__flakey__/metadata/input/app/test.tsx diff --git a/crates/next-dev-tests/tests/integration/next/app/metadata/input/app/triangle-black.png b/crates/next-dev-tests/tests/integration/next/app/__flakey__/metadata/input/app/triangle-black.png similarity index 100% rename from crates/next-dev-tests/tests/integration/next/app/metadata/input/app/triangle-black.png rename to crates/next-dev-tests/tests/integration/next/app/__flakey__/metadata/input/app/triangle-black.png diff --git a/crates/next-dev-tests/tests/integration/next/app/metadata/input/next.config.js b/crates/next-dev-tests/tests/integration/next/app/__flakey__/metadata/input/next.config.js similarity index 100% rename from crates/next-dev-tests/tests/integration/next/app/metadata/input/next.config.js rename to crates/next-dev-tests/tests/integration/next/app/__flakey__/metadata/input/next.config.js