tdewolff / minify

Go minifiers for web formats

Home Page:https://go.tacodewolff.nl/minify

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Regression with 2.20.5 (from 2.20.1)

doompadee opened this issue · comments

Updating from 2.20.1 to 2.20.5 breaks my Hugo build. The error message reads:

ERROR MINIFY: failed to transform "file.js" (text/javascript): unexpected else in expression on line 6200 and column 19
 6200:                   else if (e3 === Pl.Bytes)
                         ^

which seems to relate to the following code (from the maplibre-gl dependency I would guess):

Pl.prototype = {
  ...,skip: function(t2) {
    var e3 = 7 & t2;
    if (e3 === Pl.Varint)
      for (; this.buf[this.pos++] > 127; )
        ;
    else if (e3 === Pl.Bytes) // line 6200
      this.pos = this.readVarint() + this.pos;
    else if (e3 === Pl.Fixed32)
      this.pos += 4;
    else {
      if (e3 !== Pl.Fixed64)
        throw new Error("Unimplemented type: " + e3);
      this.pos += 8;
    }
  },...
}

Maybe minify has a problem with the empty statement in the first branch of the conditional?

Thanks, has been fixed!