From 6e8cd2e3e5d68519400ceb88de85ef56a16aa73b Mon Sep 17 00:00:00 2001 From: Jarred Sumner Date: Tue, 2 Nov 2021 22:52:38 -0700 Subject: [bun bun] `alwaysBundled` packages should use their real paths --- src/bundler.zig | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/bundler.zig b/src/bundler.zig index 97f975fe9..15d190b0c 100644 --- a/src/bundler.zig +++ b/src/bundler.zig @@ -1254,10 +1254,13 @@ pub const Bundler = struct { var package_path = path.text; var file_path = path.text; - if (resolve_result.package_json) |pkg| { - if (std.mem.indexOfScalar(u32, this.always_bundled_package_hashes, pkg.hash) != null) { + if (resolve_result.package_json) |pkg_| { + var pkg: *const PackageJSON = pkg_; + if (std.mem.indexOfScalar(u32, this.always_bundled_package_hashes, pkg.hash)) |pkg_i| { + pkg = this.always_bundled_package_jsons[pkg_i]; const key_path_source_dir = pkg.source.key_path.sourceDir(); const default_source_dir = pkg.source.path.sourceDir(); + if (strings.startsWith(path.text, key_path_source_dir)) { import_path = path.text[key_path_source_dir.len..]; } else if (strings.startsWith(path.text, default_source_dir)) { -- cgit v1.2.3