GuillaumeGomez / minifier-rs

Minifier tool/lib for JS/CSS/JSON files
MIT License
86 stars 16 forks source link

Add test for JS check with "/", "//" and "/*" #44

Closed GuillaumeGomez closed 2 years ago

alfiedotwtf commented 2 years ago

Thanks for the crate, it works great!

I just hit this issue. Nothing major, but took me a while to find it after staring at the code for so long...

I have the following:

if (!/\/(contact|legal)\//.test(window.location) && !consented) { 

This kept returning a Javascript error even though it worked fine in the browser console. Turns out that minifier::js thinks \// is a comment.

Easy hack is to just append a .* to separate the double slash... just thought you may be interested to know of this case.

GuillaumeGomez commented 2 years ago

It is indeed. I'll try to fix it as soon as possible.

alfiedotwtf commented 2 years ago

No stress, take your time.

GuillaumeGomez commented 2 years ago

Actually I'll reopen it because I still didn't add all tests. ^^'

alfiedotwtf commented 2 years ago

Thank you!