Skip to content
This repository was archived by the owner on Jul 6, 2025. It is now read-only.

Commit c8a3472

Browse files
committed
fix(compiler): fix AlephJsxBuiltinModuleResolveFold
1 parent 015bfbb commit c8a3472

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

compiler/src/jsx.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ impl Fold for AlephJsxBuiltinModuleResolveFold {
368368
format!("{}/framework/react/{}.ts", aleph_pkg_uri, name).as_str(),
369369
false,
370370
);
371-
if resolver.bundle_mode {
371+
if resolver.bundle_mode && resolver.bundle_external.contains(fixed_url.as_str()) {
372372
items.push(ModuleItem::Stmt(Stmt::Decl(Decl::Var(VarDecl {
373373
span: DUMMY_SP,
374374
kind: VarDeclKind::Const,

compiler/src/resolve_fold.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -229,10 +229,13 @@ impl Fold for ResolveFold {
229229
}))
230230
} else {
231231
if self.resolve_star_exports {
232+
let mut src = fixed_url.to_owned();
233+
src.push(':');
234+
src.push_str(resolved_path.as_str());
232235
resolver.star_exports.push(fixed_url.clone());
233236
ModuleItem::ModuleDecl(ModuleDecl::ExportAll(ExportAll {
234237
span: DUMMY_SP,
235-
src: new_str(fixed_url.into()),
238+
src: new_str(src.into()),
236239
asserts: None,
237240
}))
238241
} else {
@@ -696,8 +699,9 @@ mod tests {
696699
export default function Index() {
697700
return (
698701
<>
699-
<link rel="stylesheet" href="../style/index.css" />
700-
<head></head>
702+
<head>
703+
<link rel="stylesheet" href="../style/index.css" />
704+
</head>
701705
<Logo />
702706
<AsyncLogo />
703707
<Nav />
@@ -716,6 +720,7 @@ mod tests {
716720
vec![
717721
"https://esm.sh/react".into(),
718722
"https://esm.sh/react-dom".into(),
723+
"https://deno.land/x/aleph/framework/react/head.ts".into(),
719724
"/components/logo.tsx".into(),
720725
"/shared/iife.ts".into(),
721726
],
@@ -738,6 +743,9 @@ mod tests {
738743
assert!(code.contains(
739744
"const { default: __ALEPH_Head } = __ALEPH.pack[\"https://deno.land/x/aleph/framework/react/head.ts\"]"
740745
));
746+
assert!(code.contains(
747+
"import __ALEPH_Stylelink from \"../-/deno.land/x/aleph/framework/react/stylelink.bundling.js\""
748+
));
741749
assert!(code.contains("export const $$star_0 = __ALEPH.pack[\"https://esm.sh/react\"]"));
742750
assert!(code.contains("export const ReactDom = __ALEPH.pack[\"https://esm.sh/react-dom\"]"));
743751
assert!(code.contains("export const { render } = __ALEPH.pack[\"https://esm.sh/react-dom\"]"));

0 commit comments

Comments
 (0)