Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

breaks jquery 3.5.0, 3.5.1 #338

Closed
cat-dealer opened this issue Oct 13, 2020 · 7 comments
Closed

breaks jquery 3.5.0, 3.5.1 #338

cat-dealer opened this issue Oct 13, 2020 · 7 comments

Comments

@cat-dealer
Copy link

minification of current jquery releases produces invalid js that crashes on execution

Steps to reproduce:

@tdewolff
Copy link
Owner

Thanks for the bug report! I'm getting an Unexpected token ? and I'm on to fix it. Did you get the same or another error?

@cat-dealer
Copy link
Author

Thats the one; there have been several issues like this with this module over the past year that forced us to drop it from all projects today :(

i can list a few more annoying things we encountered if youd like some additional feedback here

@tdewolff
Copy link
Owner

Absolutely! Please tell me all the annoyances or bugs you've encountered. The JS minifier is quite recent and was a huge project, it's not unusual there might be some bugs.

@cat-dealer
Copy link
Author

  • comments of JSDoc format are removed entirely for css/js (identifiers like @preserve and @license are ignored); this kept stripping licenses out of third party js modules which can quickly become an expensive legal case (also no option to add regex matches or similar features to catch them)
  • had an issue with the css minifier messing with color declarations and numbers a while back (2+months?), which magically disappeared and reappeared between patches from around 2.6 to 2.8 but stopped recently (was a nightmare to develop with though as we had to manually test every new version and check if it had the bug again or not) - had something to do with transparency or rgba declarations, cant ask frontend devs for details right now
  • attempting to minify multiple css or js files into one bundled file results in lots of small errors (like @charset declarations ending up in the middle of files, breaking css declarations in some browsers); would have been nice to have a function that handles that, most other minifiers (terser, closure compiler, yui-compressor etc) have that feature out of the box (and merging assets is vital for network performance as it allows you to omit the tcp/tls/http overhead per request, allows gzip/brotli to compress more effectively and reduces the amount of traffic sent)

Those were the most frequent & time-consuming ones. There have been several others but i dont have the time to dig through those projects and find what exactly was the issue there for the time being

@tdewolff
Copy link
Owner

Thanks for the update!

  • the problem arises because the minifier assumes that the browser supports the nullish operator, I'll revert this because it seems IE and Android-Firefox/Android-Opera don't seem to support it yet (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Nullish_coalescing_operator)
  • I'll look into the @preserve and @license comment formats
  • the CSS colors have been fixed recently, but if you used the KeepCSS2 option it should've never been a problem (only IE has trouble with this)
  • minifying multiple files is not supported and would need a lot of work. Since a lot of companies rely on this software but nobody is able to even pay a small contribution, it's not a priority really

I appreciate the comments. In the future it would be really convenient if you'd create an issue, that would've solved most of your problems much quicker!

@tdewolff
Copy link
Owner

The @preserve and @license comment formats are formats that Google Closure Compiler respects, but it seems the most common way (which this minifier follows as well) is keeping the /*! ... */ style comments. That would've solved your problem quickly!

@tdewolff
Copy link
Owner

tdewolff commented Dec 7, 2021

The usage of the nullish operator is now enabled by default, please set option NoNullishOperator = true to prevent its usage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants