Skip to content

Commit

Permalink
Add missing code for compatibility plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
CPunisher committed Jul 8, 2024
1 parent f2bc023 commit 08aa705
Showing 1 changed file with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,23 @@ impl JavascriptParserPlugin for CompatibilityPlugin {
}),
);
return Some(true);
} else if for_name == RuntimeGlobals::REQUIRE.name() {
let low = ident.span().lo().0;
let hi = ident.span().hi().0;
parser.tag_variable(
ident.sym.to_string(),
NESTED_WEBPACK_IDENTIFIER_TAG,
Some(NestedRequireData {
name: format!("__nested_webpack_require_{low}_{hi}__"),
update: false,
loc: DependencyLocation::new(
ident.span().real_lo(),
ident.span().real_hi(),
Some(parser.source_map.clone()),
),
}),
);
return Some(true);
}
None
}
Expand Down

0 comments on commit 08aa705

Please sign in to comment.