Skip to content

Commit

Permalink
fix(next-core): refine context for unsupported edge imports (#63622)
Browse files Browse the repository at this point in the history
### What

Followup for the unsupported imports in edge to inject corresponding
context only.

Closes PACK-2824
  • Loading branch information
kwonoj authored Mar 23, 2024
1 parent 65d699e commit 98ffe45
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion packages/next-swc/crates/next-core/src/next_import_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,24 @@ pub async fn get_next_edge_import_map(
)
.await?;

insert_unsupported_node_internal_aliases(&mut import_map, project_path, execution_context);
// Look for where 'server/web/globals.ts` are imported to find out corresponding
// context
match ty {
ServerContextType::AppSSR { .. }
| ServerContextType::AppRSC { .. }
| ServerContextType::AppRoute { .. }
| ServerContextType::Middleware { .. }
| ServerContextType::Pages { .. }
| ServerContextType::PagesData { .. }
| ServerContextType::PagesApi { .. } => {
insert_unsupported_node_internal_aliases(
&mut import_map,
project_path,
execution_context,
);
}
_ => {}
}

Ok(import_map.cell())
}
Expand Down

0 comments on commit 98ffe45

Please sign in to comment.