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

Possible issue with google-closure-compiler v20201207 #7804

Closed
johndoh opened this issue Dec 30, 2020 · 2 comments
Closed

Possible issue with google-closure-compiler v20201207 #7804

johndoh opened this issue Dec 30, 2020 · 2 comments

Comments

@johndoh
Copy link
Contributor

johndoh commented Dec 30, 2020

I have stumbled across a very strange issue. When using google-closure-compiler v20201207 skins/elastic/ui.js does not minify correctly. With the previous v20201102 everything is fine. I tracked the issue down to here:

skins/elastic/ui.js line 2065:

$(bar)[is_search_pending() ? 'addClass' : 'removeClass']('active');

the issue is that the function is_search_pending() is not present in the minified JS. Changing it as follows solves the problem:

var active = is_search_pending();
$(bar)[active ? 'addClass' : 'removeClass']('active');

The issue manifests itself as the message list failing to load on login to Roundcube and the follow JS error in the console:

Uncaught TypeError: k is undefined - ui.min.js:58:144

I had a quick look through other JS files in the core and cannot see any others with the same issue but its hard to spot the differences between improvements in the compiler and errors. It feels to me like a problem with v20201207 of the complier. I had a look at their GitHub but nothing sticks out. Still may be the best approach here might simply be to wait for their next version and retest before changing Roundcube code. npm install -g google-closure-compiler@20201102 installs the previous version.

@alecpl
Copy link
Member

alecpl commented Dec 30, 2020

Or we can use UglifyJS. If I just replace google-closure-compiler command with uglifyjs --compress --mangle -- $1 >> $2 command it compiles all js files in 34 seconds instead of 43 seconds, so it is faster. Also output files are smaller. But we have to test it more carefully.

@alecpl
Copy link
Member

alecpl commented Jan 1, 2021

Switched to uglifyjs and csso. Hopefully it works in all supported browsers. I didn't do much tests.

@alecpl alecpl closed this as completed Jan 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants