Skip to content

Commit

Permalink
[bun] fix bun bun --platform=bun
Browse files Browse the repository at this point in the history
  • Loading branch information
Jarred-Sumner committed Apr 10, 2022
1 parent 45e1fc9 commit 43b1866
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions src/bundler.zig
Expand Up @@ -1066,21 +1066,20 @@ 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);
const resolved = bundler.resolveEntryPoint(entry_point_path) catch continue;
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;

Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit 43b1866

Please sign in to comment.