Skip to content

Commit

Permalink
Fix for prefix overlapping in some cases
Browse files Browse the repository at this point in the history
  • Loading branch information
nabetti1720 committed Nov 12, 2024
1 parent 2d223bf commit d73fed2
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions llrt_core/src/module_loader/loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,19 @@ impl CustomLoader {
return (false, false, name, name);
}

// If it starts with CJS_IMPORT_PREFIX, mark as from_cjs_import
if let Some(cjs_path) = name.strip_prefix(CJS_IMPORT_PREFIX) {
// If it starts with CJS_IMPORT_PREFIX, mark as from_cjs_import
if let Some(cjs_path) = cjs_path.strip_prefix(CJS_LOADER_PREFIX) {
return (true, false, cjs_path, cjs_path);
}
return (true, false, name, cjs_path);
}

// If it starts with CJS_LOADER_PREFIX, mark as is_cjs
if let Some(cjs_path) = name.strip_prefix(CJS_LOADER_PREFIX) {
// If it starts with CJS_LOADER_PREFIX, mark as is_cjs
if let Some(cjs_path) = cjs_path.strip_prefix(CJS_IMPORT_PREFIX) {
return (false, true, cjs_path, cjs_path);
}
return (false, true, cjs_path, cjs_path);
}

Expand Down

0 comments on commit d73fed2

Please sign in to comment.