diff options
author | 2022-04-10 04:24:53 -0700 | |
---|---|---|
committer | 2022-04-10 04:24:53 -0700 | |
commit | 43b18663fdc763c24ae8fa0940019f2aee37c6aa (patch) | |
tree | c2e2f38128d5b3db8f3c0417dfbfac0be64839b3 | |
parent | 45e1fc946d55948f882592b7a6b45641552793b0 (diff) | |
download | bun-43b18663fdc763c24ae8fa0940019f2aee37c6aa.tar.gz bun-43b18663fdc763c24ae8fa0940019f2aee37c6aa.tar.zst bun-43b18663fdc763c24ae8fa0940019f2aee37c6aa.zip |
[bun] fix `bun bun --platform=bun`
-rw-r--r-- | src/bundler.zig | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/src/bundler.zig b/src/bundler.zig index bb6d73db9..7657317d8 100644 --- a/src/bundler.zig +++ b/src/bundler.zig @@ -1066,7 +1066,6 @@ pub const Bundler = struct { } for (bundler.options.entry_points) |entry_point| { - if (bundler.options.platform.isBun()) continue; defer this.bundler.resetStore(); const entry_point_path = bundler.normalizeEntryPointPath(entry_point); @@ -1074,13 +1073,13 @@ pub const Bundler = struct { try this.enqueueItem(resolved); } - if (bundler.options.platform != .bun) Analytics.enqueue(Analytics.EventName.bundle_start); + Analytics.enqueue(Analytics.EventName.bundle_start); this.bundler.resetStore(); this.pool.wait(this) catch |err| { Analytics.enqueue(Analytics.EventName.bundle_fail); return err; }; - if (bundler.options.platform != .bun) Analytics.enqueue(Analytics.EventName.bundle_success); + Analytics.enqueue(Analytics.EventName.bundle_success); estimated_input_lines_of_code.* = generator.estimated_input_lines_of_code; @@ -2556,12 +2555,20 @@ pub const Bundler = struct { false, ); - output_file.size = try bundler.print( - result, - js_printer.FileWriter, - js_printer.NewFileWriter(file), - .esm, - ); + output_file.size = switch (bundler.options.platform) { + .neutral, .browser, .node => try bundler.print( + result, + js_printer.FileWriter, + js_printer.NewFileWriter(file), + .esm, + ), + .bun, .bun_macro => try bundler.print( + result, + js_printer.FileWriter, + js_printer.NewFileWriter(file), + .esm_ascii, + ), + }; var file_op = options.OutputFile.FileOperation.fromFile(file.handle, file_path.pretty); |