fix client-only alias in SSRed client components (#57484)
### What? client-only is allows in SSR, server-only should error Closes WEB-1883
This commit is contained in:
parent
581b1be064
commit
9d8dbfa337
1 changed files with 12 additions and 1 deletions
|
@ -573,7 +573,6 @@ async fn insert_next_server_special_aliases(
|
|||
// TODO: should include `ServerContextType::PagesApi` routes, but that type doesn't exist.
|
||||
ServerContextType::AppRSC { .. }
|
||||
| ServerContextType::AppRoute { .. }
|
||||
| ServerContextType::AppSSR { .. }
|
||||
| ServerContextType::Middleware => {
|
||||
insert_exact_alias_map(
|
||||
import_map,
|
||||
|
@ -586,6 +585,18 @@ async fn insert_next_server_special_aliases(
|
|||
},
|
||||
);
|
||||
}
|
||||
ServerContextType::AppSSR { .. } => {
|
||||
insert_exact_alias_map(
|
||||
import_map,
|
||||
project_path,
|
||||
indexmap! {
|
||||
"server-only" => "next/dist/compiled/server-only/index".to_string(),
|
||||
"client-only" => "next/dist/compiled/client-only/index".to_string(),
|
||||
"next/dist/compiled/server-only" => "next/dist/compiled/server-only/index".to_string(),
|
||||
"next/dist/compiled/client-only" => "next/dist/compiled/client-only/index".to_string(),
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Potential the bundle introduced into middleware and api can be poisoned by
|
||||
|
|
Loading…
Reference in a new issue