Unverified Commit 9d8dbfa3 authored by Tobias Koppers's avatar Tobias Koppers Committed by GitHub

fix client-only alias in SSRed client components (#57484)

### What?

client-only is allows in SSR, server-only should error



Closes WEB-1883
parent 581b1be0
......@@ -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
......
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