Skip to content

Commit

Permalink
add react-server condition to middleware, and apis
Browse files Browse the repository at this point in the history
  • Loading branch information
sokra committed Mar 20, 2024
1 parent 9e3d074 commit d9ebb61
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions packages/next-swc/crates/next-core/src/next_server/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,13 +161,15 @@ pub async fn get_server_resolve_options_context(
custom_conditions.extend(ty.conditions().iter().map(ToString::to_string));

match ty {
ServerContextType::AppRSC { .. } => custom_conditions.push("react-server".to_string()),
ServerContextType::AppRoute { .. }
| ServerContextType::Pages { .. }
| ServerContextType::PagesData { .. }
ServerContextType::AppRSC { .. }
| ServerContextType::AppRoute { .. }
| ServerContextType::PagesApi { .. }
| ServerContextType::Middleware { .. } => {
custom_conditions.push("react-server".to_string())
}
ServerContextType::Pages { .. }
| ServerContextType::PagesData { .. }
| ServerContextType::AppSSR { .. }
| ServerContextType::Middleware { .. }
| ServerContextType::Instrumentation { .. } => {}
};
let external_cjs_modules_plugin = ExternalCjsModulesResolvePlugin::new(
Expand Down

0 comments on commit d9ebb61

Please sign in to comment.