Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(turbopack): ignore underscore_started path #48792

Merged
merged 4 commits into from
Apr 28, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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);
sokra marked this conversation as resolved.
Show resolved Hide resolved
}
}
// 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