From 1af4e1dce1f4e89f2581872e390c7e68150ecf29 Mon Sep 17 00:00:00 2001 From: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> Date: Mon, 1 May 2023 16:55:50 -0700 Subject: [PATCH] Fixes #2783 --- src/bundler/bundle_v2.zig | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/bundler/bundle_v2.zig b/src/bundler/bundle_v2.zig index 82ead3ea3a..fd5aadd8d9 100644 --- a/src/bundler/bundle_v2.zig +++ b/src/bundler/bundle_v2.zig @@ -3967,7 +3967,8 @@ const LinkerContext = struct { // returns a promise, so the imported file must be a CommonJS module if (exports_kind[other_file] == .esm) { flags[other_file].wrap = .esm; - } else if (!force_cjs_to_esm[other_file]) { + } else { + // even if force_cjs_to_esm[other_file]) is true, we need to wrap flags[other_file].wrap = .cjs; exports_kind[other_file] = .cjs; } @@ -10183,7 +10184,7 @@ pub const Chunk = struct { } std.debug.assert(remain.len == 0); - std.debug.assert(total_buf.len == count); + std.debug.assert(total_buf.len == count + debug_id_len); return .{ .buffer = total_buf,