add back whitespace checks but limited to 33 bytes

This commit is contained in:
pfg
2024-12-06 20:03:20 -08:00
parent 1982df220b
commit 93fdbed85d
4 changed files with 25 additions and 1 deletions

View File

@@ -2051,7 +2051,7 @@ pub fn IncrementalGraph(side: bake.Side) type {
if (Environment.allow_assert) {
switch (kind) {
.css => bun.assert(code.len == 0),
.js => if (code.len == 0 or (code.len < 33 and std.mem.trimLeft(u8, code, "\n\r ").len == 0)) {
.js => if (bun.strings.isSmallAndOnlyWhitespace(code)) {
// Should at least contain the function wrapper
bun.Output.panic("Empty chunk is impossible: {s} {s}", .{
key,