diff --git a/llrt_core/src/module_loader/loader.rs b/llrt_core/src/module_loader/loader.rs index 33f40cfd32..574d5ccf14 100644 --- a/llrt_core/src/module_loader/loader.rs +++ b/llrt_core/src/module_loader/loader.rs @@ -138,19 +138,13 @@ 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 let Some(cjs_path) = cjs_path.strip_prefix(CJS_LOADER_PREFIX) { - return (true, false, cjs_path, cjs_path); - } + // If it starts with CJS_IMPORT_PREFIX, mark as from_cjs_import 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 let Some(cjs_path) = cjs_path.strip_prefix(CJS_IMPORT_PREFIX) { - return (false, true, cjs_path, cjs_path); - } + // If it starts with CJS_LOADER_PREFIX, mark as is_cjs return (false, true, cjs_path, cjs_path); }