Unverified Commit 6e896d3d authored by Tobias Koppers's avatar Tobias Koppers Committed by GitHub

add missing aliases for next/dynamic and next/head (#48871)

### What?

missing aliases for app dir functionality

### Why?

### How?
parent 1274713b
...@@ -214,6 +214,15 @@ pub async fn get_next_server_import_map( ...@@ -214,6 +214,15 @@ pub async fn get_next_server_import_map(
ServerContextType::AppSSR { .. } ServerContextType::AppSSR { .. }
| ServerContextType::AppRSC { .. } | ServerContextType::AppRSC { .. }
| ServerContextType::AppRoute { .. } => { | ServerContextType::AppRoute { .. } => {
import_map.insert_exact_alias(
"next/head",
request_to_import_mapping(project_path, "next/dist/client/components/noop-head"),
);
import_map.insert_exact_alias(
"next/dynamic",
request_to_import_mapping(project_path, "next/dist/shared/lib/app-dynamic"),
);
for name in next_config.server_component_externals().await?.iter() { for name in next_config.server_component_externals().await?.iter() {
import_map.insert_exact_alias(name, external); import_map.insert_exact_alias(name, external);
import_map.insert_wildcard_alias(format!("{name}/"), external); import_map.insert_wildcard_alias(format!("{name}/"), external);
...@@ -251,6 +260,23 @@ pub async fn get_next_edge_import_map( ...@@ -251,6 +260,23 @@ pub async fn get_next_edge_import_map(
insert_next_server_special_aliases(&mut import_map, ty).await?; insert_next_server_special_aliases(&mut import_map, ty).await?;
match ty {
ServerContextType::Pages { .. } | ServerContextType::PagesData { .. } => {}
ServerContextType::AppSSR { .. }
| ServerContextType::AppRSC { .. }
| ServerContextType::AppRoute { .. } => {
import_map.insert_exact_alias(
"next/head",
request_to_import_mapping(project_path, "next/dist/client/components/noop-head"),
);
import_map.insert_exact_alias(
"next/dynamic",
request_to_import_mapping(project_path, "next/dist/shared/lib/app-dynamic"),
);
}
ServerContextType::Middleware => {}
}
Ok(import_map.cell()) Ok(import_map.cell())
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment