diff options
author | 2021-06-29 17:47:58 -0700 | |
---|---|---|
committer | 2021-06-29 17:47:58 -0700 | |
commit | 3f197d1ce0c197864ad4c7c7b8238af4370275b4 (patch) | |
tree | 7d76dcc182e80c5b67db1568e769977229649980 /src/options.zig | |
parent | 26745bb5f300481fc242c8e81de6f252f698c863 (diff) | |
download | bun-3f197d1ce0c197864ad4c7c7b8238af4370275b4.tar.gz bun-3f197d1ce0c197864ad4c7c7b8238af4370275b4.tar.zst bun-3f197d1ce0c197864ad4c7c7b8238af4370275b4.zip |
Fix crash, fix detecting node_modules, fix undefined not being simplified
Diffstat (limited to 'src/options.zig')
-rw-r--r-- | src/options.zig | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/options.zig b/src/options.zig index 132de8ca3..50f3efb11 100644 --- a/src/options.zig +++ b/src/options.zig @@ -249,6 +249,13 @@ pub const Platform = enum { speedy, node, + pub fn implementsRequire(platform: Platform) bool { + return switch (platform) { + .speedy, .node => true, + else => false, + }; + } + pub const Extensions = struct { pub const In = struct { pub const JavaScript = [_]string{ ".js", ".ts", ".tsx", ".jsx", ".json" }; @@ -754,7 +761,7 @@ pub const BundleOptions = struct { opts.output_dir_handle = try openOutputDir(opts.output_dir); } - if (opts.resolve_mode == .lazy and !(transform.generate_node_module_bundle orelse false)) { + if (!(transform.generate_node_module_bundle orelse false)) { if (node_modules_bundle_existing) |node_mods| { opts.node_modules_bundle = node_mods; const pretty_path = fs.relativeTo(transform.node_modules_bundle_path.?); @@ -768,6 +775,7 @@ pub const BundleOptions = struct { const pretty_path = fs.relativeTo(bundle_path); var bundle_file = std.fs.openFileAbsolute(bundle_path, .{ .read = true, .write = true }) catch |err| { Output.disableBuffering(); + defer Output.enableBuffering(); Output.prettyErrorln("<r>error opening <d>\"<r><b>{s}<r><d>\":<r> <b><red>{s}<r>", .{ pretty_path, @errorName(err) }); break :load_bundle; }; |