Skip to content

Commit

Permalink
turbopack: should only create _not-found when path_prefix is root (#5…
Browse files Browse the repository at this point in the history
…4687)

Should only create default prod _not-found when prefix path is "/"

x-ref: https://github.com/vercel/next.js/pull/54199/files#r1307993106
  • Loading branch information
huozhi authored Aug 29, 2023
1 parent 2122e57 commit 6e9a61e
Showing 1 changed file with 27 additions and 27 deletions.
54 changes: 27 additions & 27 deletions packages/next-swc/crates/next-core/src/app_structure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -788,36 +788,36 @@ async fn directory_tree_to_entrypoints_internal(
dev_not_found_tree,
)
.await?;
}
} else {
// Create default not-found page for production if there's no customized
// not-found
let prod_not_found_tree = LoaderTree {
segment: directory_name.to_string(),
parallel_routes: indexmap! {
"children".to_string() => LoaderTree {
segment: "__PAGE__".to_string(),
parallel_routes: IndexMap::new(),
components: Components {
page: Some(get_next_package(app_dir).join("dist/client/components/not-found-error.js".to_string())),
..Default::default()
} else {
// Create default not-found page for production if there's no customized
// not-found
let prod_not_found_tree = LoaderTree {
segment: directory_name.to_string(),
parallel_routes: indexmap! {
"children".to_string() => LoaderTree {
segment: "__PAGE__".to_string(),
parallel_routes: IndexMap::new(),
components: Components {
page: Some(get_next_package(app_dir).join("dist/client/components/not-found-error.js".to_string())),
..Default::default()
}
.cell(),
}
.cell(),
}
.cell(),
},
components: components.without_leafs().cell(),
}
.cell();
},
components: components.without_leafs().cell(),
}
.cell();

add_app_page(
app_dir,
&mut result,
"/_not-found".to_string(),
"/_not-found".to_string(),
prod_not_found_tree,
)
.await?;
add_app_page(
app_dir,
&mut result,
"/_not-found".to_string(),
"/_not-found".to_string(),
prod_not_found_tree,
)
.await?;
}
}

for (subdir_name, &subdirectory) in subdirectories.iter() {
Expand Down

0 comments on commit 6e9a61e

Please sign in to comment.