From 59ca9813dae8ac0c52a7842e8f5c58d044c3ec2e Mon Sep 17 00:00:00 2001 From: dave caruso Date: Wed, 24 Jul 2024 16:33:36 -0700 Subject: [PATCH] ok --- src/bundler/bundle_v2.zig | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/bundler/bundle_v2.zig b/src/bundler/bundle_v2.zig index ea09e1bdb0..f0eefc8af5 100644 --- a/src/bundler/bundle_v2.zig +++ b/src/bundler/bundle_v2.zig @@ -5253,10 +5253,7 @@ pub const LinkerContext = struct { // Don't follow external imports (this includes import() expressions) if (!record.source_index.isValid() or this.isExternalDynamicImport(record, source_index)) { // This is an external import. Check if it will be a "require()" call. - if (kind == .require or - !output_format.keepES6ImportExportSyntax() - // todo: kind == .import and c.options.UnsupportedJSFeatures.Has(compat.DynamicImport) - ) { + if (kind == .require or !output_format.keepES6ImportExportSyntax() or kind == .dynamic) { if (record.source_index.isValid() and kind == .dynamic and ast_flags[other_id].force_cjs_to_esm) { // If the CommonJS module was converted to ESM // and the developer `import("cjs_module")`, then @@ -5273,7 +5270,7 @@ pub const LinkerContext = struct { // We should use "__require" instead of "require" if we're not // generating a CommonJS output file, since it won't exist otherwise. // Disabled for target bun because `import.meta.require` will be inlined. - if (shouldCallRuntimeRequire(output_format) and !this.resolver.opts.target.isBun()) { + if (kind != .dynamic or shouldCallRuntimeRequire(output_format) and !this.resolver.opts.target.isBun()) { record.calls_runtime_require = true; runtime_require_uses += 1; }