JSGroupings fails to minify minified files, missing javascript cache files #10000
Labels
Priority:Important
Issues & PRs that are important; broken functions, errors - there are workarounds
Status:Needs Assessed
Needs the core team to assess
Type: Bug
Bugs within the core SuiteCRM codebase
Issue
JSGroupings lists many files in the grouping that already are minified, and then the code in minify_utils.php checks if it it can find the minified files .. incorrectly.
minify_utils.php
if the file is resize-min.js, it now checks for resize-min-min.js in the baseline, which it does not find. So then it tries to minify the minified file. Unfortunately I had an issue in my deployed instance where it is missing half the cache/include/javascript/*.js files. It throws a fatal error in the (vendor/tedivm/jshrink/src/JShrink/Minifier.php:290) called several levels up by jssource/SugarMin.php:40
Exception in Controller: Unclosed regex pattern at position: 18261
and more debugging shows that it fails to minify a minified file. I believe minifying the minified files causes an error in the minifier: I believe that this is due to the minified files sometimes hitting: tedious/JShrink#87
This code exists in suitecrm 7.13.2 and also in the suitecrm 8.2.4 baseline.
Expected Behavior
JSGroupings should be created consistently in the cache directory.
JSGroupings should not list minified files in the groupings. And perhaps the SuiteCRM baseline should not contain minified files (#7333).
Actual Behavior
When building the cached JS Groupings files, the code tries to minify the already minified javascript. It can run into errors in the minifier: (tedious/JShrink#87) and fail to create some of the cached javascript files.
Possible Fix
Find and replace '-min.js' in jssource/JSGroupings.php with '.js'
Steps to Reproduce
Context
Your Environment
The text was updated successfully, but these errors were encountered: