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

Commit cbc0dec

Browse files
committed
fix(compiler): fix repeated deps
1 parent 6662368 commit cbc0dec

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

compiler/src/fixer.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ impl Fold for JSXLinkFixer {
3636
let rel = rel.as_str();
3737
match rel {
3838
"style" | "stylesheet" => {
39-
let (url, _) = resolver.resolve(dep.specifier.as_str(), false, None);
39+
let (url, _) =
40+
resolver.resolve(dep.specifier.as_str(), false, Some(".".into()));
4041
items.push(ModuleItem::ModuleDecl(ModuleDecl::Import(ImportDecl {
4142
span: DUMMY_SP,
4243
specifiers: vec![],

compiler/src/resolve.rs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -346,11 +346,17 @@ impl Resolver {
346346
},
347347
None => {}
348348
};
349-
self.dep_graph.push(DependencyDescriptor {
350-
specifier: fixed_url.clone(),
351-
is_dynamic,
352-
rel,
353-
});
349+
let update_dep_graph = match rel {
350+
Some(ref rel) => !rel.eq("."),
351+
None => true,
352+
};
353+
if update_dep_graph {
354+
self.dep_graph.push(DependencyDescriptor {
355+
specifier: fixed_url.clone(),
356+
is_dynamic,
357+
rel,
358+
});
359+
}
354360
let path = resolved_path.to_slash().unwrap();
355361
if !path.starts_with("./") && !path.starts_with("../") && !path.starts_with("/") {
356362
return (format!("./{}", path), fixed_url);

0 commit comments

Comments
 (0)