Skip to content

Commit

Permalink
create forked impl for Link component
Browse files Browse the repository at this point in the history
  • Loading branch information
ztanner committed Nov 20, 2024
1 parent 0344392 commit 3cc453f
Show file tree
Hide file tree
Showing 3 changed files with 780 additions and 0 deletions.
12 changes: 12 additions & 0 deletions crates/next-core/src/next_import_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,10 @@ pub async fn get_next_client_import_map(
"next/dynamic",
request_to_import_mapping(project_path, "next/dist/shared/lib/app-dynamic"),
);
import_map.insert_exact_alias(
"next/link",
request_to_import_mapping(project_path, "next/dist/client/app-dir/link"),
);
}
ClientContextType::Fallback => {}
ClientContextType::Other => {}
Expand Down Expand Up @@ -365,6 +369,10 @@ pub async fn get_next_server_import_map(
"next/dynamic",
request_to_import_mapping(project_path, "next/dist/shared/lib/app-dynamic"),
);
import_map.insert_exact_alias(
"next/link",
request_to_import_mapping(project_path, "next/dist/client/app-dir/link"),
)
}
ServerContextType::Middleware { .. } | ServerContextType::Instrumentation { .. } => {}
}
Expand Down Expand Up @@ -469,6 +477,10 @@ pub async fn get_next_edge_import_map(
"next/dynamic",
request_to_import_mapping(project_path, "next/dist/shared/lib/app-dynamic"),
);
import_map.insert_exact_alias(
"next/link",
request_to_import_mapping(project_path, "next/dist/client/app-dir/link"),
)
}
}

Expand Down
1 change: 1 addition & 0 deletions packages/next/src/build/create-compiler-aliases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ export function createAppRouterApiAliases(isServerOnlyLayer: boolean) {
const mapping: Record<string, string> = {
head: 'next/dist/client/components/noop-head',
dynamic: 'next/dist/api/app-dynamic',
link: 'next/dist/client/app-dir/link',
}

if (isServerOnlyLayer) {
Expand Down
Loading

0 comments on commit 3cc453f

Please sign in to comment.