diff options
author | 2022-09-19 21:02:26 -0700 | |
---|---|---|
committer | 2022-09-19 21:02:26 -0700 | |
commit | 8b7f43f8553eb0f012b7507ff1d2025bc646cc1c (patch) | |
tree | da27e9ba9fcdb044af792291944aa10da6ac74c0 /src/resolver/resolver.zig | |
parent | 21770eb0f31a43b3d6127ab957e271d029d6bc1b (diff) | |
download | bun-8b7f43f8553eb0f012b7507ff1d2025bc646cc1c.tar.gz bun-8b7f43f8553eb0f012b7507ff1d2025bc646cc1c.tar.zst bun-8b7f43f8553eb0f012b7507ff1d2025bc646cc1c.zip |
Handle nested files more correctly with "imports" in package.json
Diffstat (limited to '')
-rw-r--r-- | src/resolver/resolver.zig | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/resolver/resolver.zig b/src/resolver/resolver.zig index 6496ce118..56ce3135e 100644 --- a/src/resolver/resolver.zig +++ b/src/resolver/resolver.zig @@ -1229,7 +1229,7 @@ pub const Resolver = struct { if (import_path[0] == '#' and !forbid_imports) { if (esm_ != null) { - if (dir_info.package_json) |package_json| { + if (dir_info.enclosing_package_json) |package_json| { load_from_imports_map: { const imports_map = package_json.imports orelse break :load_from_imports_map; @@ -1259,7 +1259,7 @@ pub const Resolver = struct { true, ); - return r.handleESMResolution(esm_resolution, dir_info.abs_path, kind, package_json); + return r.handleESMResolution(esm_resolution, package_json.source.path.name.dir, kind, package_json); } } } @@ -1305,9 +1305,7 @@ pub const Resolver = struct { // directory path accidentally being interpreted as URL escapes. const esm_resolution = esmodule.resolve("/", esm.subpath, exports_map.root); - if (r.handleESMResolution(esm_resolution, abs_package_path, kind, package_json)) |res| { - return res; - } + return r.handleESMResolution(esm_resolution, abs_package_path, kind, package_json); } } } |