The following Javascript results in a SyntaxError when minified. Unminified source:
class Badge extends HTMLElement{$badge;$badgeContent;$defaults={positionX:'left',positionY:'bottom',mode:'auto',transition:'slide',delayType:'time',delay:1000,url:null,target:'_self',hideOn:null} constructor(){super();this.attachShadow({mode:'open'});}
After minification:
class Badge extends HTMLElement{$badge;$badgeContent;$defaults={positionX:'left',positionY:'bottom',mode:'auto',transition:'slide',delayType:'time',delay:1000,url:null,target:'_self',hideOn:null}constructor(){super();this.attachShadow({mode:'open'});}
When the newline is removed before the constructor, the browser is unable to automatically insert a ;. Manually editing the code to add the ; resolves the issue:
class Badge extends HTMLElement{$badge;$badgeContent;$defaults={positionX:'left',positionY:'bottom',mode:'auto',transition:'slide',delayType:'time',delay:1000,url:null,target:'_self',hideOn:null};constructor(){super();this.attachShadow({mode:'open'});}
I've contacted the author of the Javascript above and reported the issue as well. I am reporting here in case the parser can be improved for these situations. I have tested in Firefox (104.0.2) and Safari (Version 15.6.1 (17613.3.9.1.16)). In Safari, the error is SyntaxError: Unexpected identifier 'constructor'. Expected a ';' following a class field.