ligershark / WebOptimizer

A bundler and minifier for ASP.NET Core
Apache License 2.0
750 stars 113 forks source link

Uncaught SyntaxError: Unexpected token in minified file #291

Open edika99 opened 8 months ago

edika99 commented 8 months ago

This function is not minified propperly, generating a bad js file with incorrect syntax:

const escapeHTML = str => str.replace(/[&<>'"]/g, tag => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', "'": '&#39;', '"': '&quot;' }[tag]));

generate this invalid js

const escapeHTML=n=>n.replace(/[&<>'"]/g,n=>{"&":"&amp;","<":"&lt;",">":"&gt;","'":"&#39;",'"':"&quot;"}[n])

giving in the browser this error that compromise the load of the entire page

common.js:1 Uncaught SyntaxError: Unexpected token ':' (at common.js:1:5829)