diff options
author | 2021-11-02 22:52:38 -0700 | |
---|---|---|
committer | 2021-11-02 22:52:38 -0700 | |
commit | 6e8cd2e3e5d68519400ceb88de85ef56a16aa73b (patch) | |
tree | 4aaca7f0ecc1f6ededc0c7491ddd96110e4e2bc3 | |
parent | c0c752749783d0de9c2893c8f53923312001991e (diff) | |
download | bun-6e8cd2e3e5d68519400ceb88de85ef56a16aa73b.tar.gz bun-6e8cd2e3e5d68519400ceb88de85ef56a16aa73b.tar.zst bun-6e8cd2e3e5d68519400ceb88de85ef56a16aa73b.zip |
[bun bun] `alwaysBundled` packages should use their real paths
-rw-r--r-- | src/bundler.zig | 7 |
1 files 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)) { |