Skip to content

Commit

Permalink
fix styled-jsx alias
Browse files Browse the repository at this point in the history
  • Loading branch information
sokra committed Sep 19, 2023
1 parent 1025011 commit e5a9f6c
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions packages/next-swc/crates/next-core/src/next_import_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -389,11 +389,6 @@ async fn insert_next_server_special_aliases(
NextRuntime::Edge => request_to_import_mapping(context_dir, request),
NextRuntime::NodeJs => external_request_to_import_mapping(request),
};
let passthrough_external_if_node =
move |context_dir: Vc<FileSystemPath>, request: &str| match runtime {
NextRuntime::Edge => request_to_import_mapping(context_dir, request),
NextRuntime::NodeJs => ImportMapping::External(None).cell(),
};
match (mode, ty) {
(_, ServerContextType::Pages { pages_dir }) => {
import_map.insert_exact_alias(
Expand Down Expand Up @@ -441,11 +436,11 @@ async fn insert_next_server_special_aliases(
);
import_map.insert_exact_alias(
"styled-jsx",
passthrough_external_if_node(app_dir, "next/dist/compiled/styled-jsx"),
request_to_import_mapping(get_next_package(app_dir), "styled-jsx"),
);
import_map.insert_wildcard_alias(
"styled-jsx/",
passthrough_external_if_node(app_dir, "next/dist/compiled/styled-jsx/*"),
request_to_import_mapping(get_next_package(app_dir), "styled-jsx/*"),
);
import_map.insert_exact_alias(
"react/jsx-runtime",
Expand Down Expand Up @@ -561,6 +556,14 @@ async fn insert_next_server_special_aliases(
// @opentelemetry/api
request_to_import_mapping(app_dir, "next/dist/compiled/@opentelemetry/api"),
);
import_map.insert_exact_alias(
"styled-jsx",
request_to_import_mapping(get_next_package(app_dir), "styled-jsx"),
);
import_map.insert_wildcard_alias(
"styled-jsx/",
request_to_import_mapping(get_next_package(app_dir), "styled-jsx/*"),
);

import_map.insert_exact_alias(
"react/jsx-runtime",
Expand Down

0 comments on commit e5a9f6c

Please sign in to comment.