Skip to content

Commit

Permalink
fix(turbopack): ignore underscore_started path
Browse files Browse the repository at this point in the history
  • Loading branch information
kwonoj committed Apr 26, 2023
1 parent 2f6ff0d commit a329c74
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions packages/next-swc/crates/next-core/src/app_structure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,12 @@ async fn get_directory_tree(
}
}
DirectoryEntry::Directory(dir) => {
let result = get_directory_tree(dir, page_extensions);
subdirectories.insert(basename.to_string(), result);
// appDir ignores paths starting with an underscore
if !basename.starts_with('_') {
let result = get_directory_tree(dir, page_extensions);
subdirectories
.insert(get_underscore_normalized_path(basename).to_string(), result);
}
}
// TODO handle symlinks in app dir
_ => {}
Expand Down Expand Up @@ -576,6 +580,12 @@ async fn directory_tree_to_entrypoints_internal(
Ok(EntrypointsVc::cell(result))
}

/// ref: https://github.com/vercel/next.js/blob/c390c1662bc79e12cf7c037dcb382ef5ead6e492/packages/next/src/build/entries.ts#L119
/// if path contains %5F, replace it with _.
fn get_underscore_normalized_path(path: &str) -> String {
path.replace("%5F", "_")
}

#[turbo_tasks::value(shared)]
struct DirectoryTreeIssue {
pub severity: IssueSeverityVc,
Expand Down

0 comments on commit a329c74

Please sign in to comment.