Skip to content

Commit

Permalink
chore: 🤖 add condition
Browse files Browse the repository at this point in the history
  • Loading branch information
IWANABETHATGUY committed Sep 17, 2023
1 parent 4035553 commit e7d103c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion crates/rspack_core/src/exports_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1170,7 +1170,7 @@ pub fn get_dependency_used_by_exports_condition(
UsedByExports::Set(used_by_exports) => {
let used_by_exports = Arc::new(used_by_exports.clone());
Some(DependencyCondition::Fn(Box::new(
move |_, runtime, module_graph| {
move |_, runtime, module_graph: &ModuleGraph| {
let module_identifier = module_graph
.parent_module_by_dependency_id(&dependency_id)
.expect("should have parent module");
Expand Down
6 changes: 4 additions & 2 deletions crates/rspack_core/src/module_graph/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ impl ModuleGraph {
) -> Result<()> {
let module_dependency = dependency.as_module_dependency().is_some();
let dependency_id = *dependency.id();
let condition = dependency
.as_module_dependency()
.and_then(|dep| dep.get_condition());
self.add_dependency(dependency);
self
.dependency_id_to_module_identifier
Expand All @@ -133,12 +136,11 @@ impl ModuleGraph {
}

// TODO: just a placeholder here, finish this when we have basic `getCondition` logic
let condition: Option<DependencyCondition> = None;
let new_connection = ModuleGraphConnection::new(
original_module_identifier,
dependency_id,
module_identifier,
condition,
None,
);

let connection_id = if let Some(connection_id) = self.connections_map.get(&new_connection) {
Expand Down

0 comments on commit e7d103c

Please sign in to comment.