mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 10:28:47 +00:00
Fix the extremely annoying ./ requirement in bun build
This commit is contained in:
@@ -404,19 +404,11 @@ pub const Bundler = struct {
|
||||
pub inline fn resolveEntryPoint(bundler: *Bundler, entry_point: string) anyerror!_resolver.Result {
|
||||
return bundler.resolver.resolve(bundler.fs.top_level_dir, entry_point, .entry_point) catch |err| {
|
||||
const has_dot_slash_form = !strings.hasPrefix(entry_point, "./") and brk: {
|
||||
_ = bundler.resolver.resolve(bundler.fs.top_level_dir, try strings.append(bundler.allocator, "./", entry_point), .entry_point) catch break :brk false;
|
||||
break :brk true;
|
||||
return bundler.resolver.resolve(bundler.fs.top_level_dir, try strings.append(bundler.allocator, "./", entry_point), .entry_point) catch break :brk false;
|
||||
};
|
||||
_ = has_dot_slash_form;
|
||||
|
||||
if (has_dot_slash_form) {
|
||||
bundler.log.addErrorFmt(null, logger.Loc.Empty, bundler.allocator, "{s} resolving \"{s}\". Did you mean: \"./{s}\"", .{
|
||||
@errorName(err),
|
||||
entry_point,
|
||||
entry_point,
|
||||
}) catch unreachable;
|
||||
} else {
|
||||
bundler.log.addErrorFmt(null, logger.Loc.Empty, bundler.allocator, "{s} resolving \"{s}\" (entry point)", .{ @errorName(err), entry_point }) catch unreachable;
|
||||
}
|
||||
bundler.log.addErrorFmt(null, logger.Loc.Empty, bundler.allocator, "{s} resolving \"{s}\" (entry point)", .{ @errorName(err), entry_point }) catch unreachable;
|
||||
|
||||
return err;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user