diff options
-rw-r--r-- | src/bundler.zig | 47 | ||||
-rw-r--r-- | src/cli/build_command.zig | 5 |
2 files changed, 31 insertions, 21 deletions
diff --git a/src/bundler.zig b/src/bundler.zig index 0f98a9ffb..997d5976f 100644 --- a/src/bundler.zig +++ b/src/bundler.zig @@ -874,7 +874,10 @@ pub const Bundler = struct { } if (bundler.options.target.isBun()) { - try bundler.linker.link(file_path, &result, origin, import_path_format, false, true); + if (!bundler.options.transform_only) { + try bundler.linker.link(file_path, &result, origin, import_path_format, false, true); + } + return BuildResolveResultPair{ .written = switch (result.ast.exports_kind) { .esm => try bundler.printWithSourceMapMaybe( @@ -901,7 +904,9 @@ pub const Bundler = struct { }; } - try bundler.linker.link(file_path, &result, origin, import_path_format, false, false); + if (!bundler.options.transform_only) { + try bundler.linker.link(file_path, &result, origin, import_path_format, false, false); + } return BuildResolveResultPair{ .written = switch (result.ast.exports_kind) { @@ -990,24 +995,26 @@ pub const Bundler = struct { ) orelse { return null; }; - if (!bundler.options.target.isBun()) - try bundler.linker.link( - file_path, - &result, - bundler.options.origin, - import_path_format, - false, - false, - ) - else - try bundler.linker.link( - file_path, - &result, - bundler.options.origin, - import_path_format, - false, - true, - ); + if (!bundler.options.transform_only) { + if (!bundler.options.target.isBun()) + try bundler.linker.link( + file_path, + &result, + bundler.options.origin, + import_path_format, + false, + false, + ) + else + try bundler.linker.link( + file_path, + &result, + bundler.options.origin, + import_path_format, + false, + true, + ); + } output_file.size = switch (bundler.options.target) { .browser, .node => try bundler.print( diff --git a/src/cli/build_command.zig b/src/cli/build_command.zig index c45db8724..6bee82899 100644 --- a/src/cli/build_command.zig +++ b/src/cli/build_command.zig @@ -88,6 +88,10 @@ pub const BuildCommand = struct { this_bundler.resolver.opts.react_server_components = ctx.bundler_options.react_server_components; this_bundler.options.code_splitting = ctx.bundler_options.code_splitting; this_bundler.resolver.opts.code_splitting = ctx.bundler_options.code_splitting; + this_bundler.options.transform_only = ctx.bundler_options.transform_only; + if (this_bundler.options.transform_only) { + this_bundler.options.resolve_mode = .disable; + } this_bundler.configureLinker(); @@ -121,7 +125,6 @@ pub const BuildCommand = struct { const output_files: []options.OutputFile = brk: { if (ctx.bundler_options.transform_only) { - this_bundler.linker.options.resolve_mode = .lazy; this_bundler.options.import_path_format = .relative; this_bundler.options.allow_runtime = false; this_bundler.resolver.opts.allow_runtime = false; |