Open Findus23 opened 4 years ago
Of course after replacing it with a maintained minifier we need to test if all features still work and that the minifier doesn't use any features that are missing in ancient browsers,
This might be bit hard?
Just to understand: Is the benefit that it will result in a slightly smaller minified JS basically?
Since this is basically no breaking change for users, I would prefer to move this into the priority backlog or 4.1 or 4.2 for now to keep 4.0 as small as possible (otherwise takes much longer to work on 4.0).
Maybe a quick test be to use some modern minifier, then use the minifier we use, and see how much different the resulting JS file size is to evaluate if it's worth doing or not.
I looked into it again and tested UglifyJS3 (https://github.com/mishoo/UglifyJS2) which is the most popular minifier (used by over 4 Million github repos) for ECMAScript 5. (It doesn't support newer JS features, but it will take ages until we can support them in the tracking code anyway, so this should not matter)
uglifyjs piwik.js -c -m eval --comments -o piwik.ugl.js
Things I noticed:
pluginTrackerHook
"use strict"
line, which might have had weird concequences.fyi @rr-it Opened a PR and an issue in https://github.com/matomo-org/matomo/issues/20964 to suggest a new compiler :raised_hands:
related to https://github.com/matomo-org/matomo/pull/12774 also related to https://github.com/matomo-org/matomo/issues/5165
The last release for yuicompressor is nearly 7 years old. Especially for a fast moving language like Javascript this means that it was designed for browsers that have little in common with the ones that exist now.
Of course after replacing it with a maintained minifier we need to test if all features still work and that the minifier doesn't use any features that are missing in ancient browsers,