It seems that XWiki uses the Google Closure Compiler to minify JavaScript. Also, it seems that Google Closure Compiler does not support modern JavaScript syntax completely (please have a look on the "no"s at the bottom of this page: Link). At least, if I use a JavaScript class with private member (=> "private" means, the name of the member starts with "#"), the Google Closure Compiler seems to have problems with that and logs error messages like the following (here the privat member was called #getLocale):
2025-07-14 05:39:44,591 [qtp107456312-42 - http:Jul 14, 2025 5:40:15 AM com.google.javascript.jscomp.LoggerErrorManager println
SEVERE: xwiki:xwiki-tools.WebHome:50:11: ERROR - [JSC_PARSE_ERROR] Parse error. 'identifier' expected
50| this.#getLocale = getLocale;
^
Jul 14, 2025 5:40:15 AM com.google.javascript.jscomp.LoggerErrorManager printSummary
WARNING: 1 error(s), 0 warning(s)
If my interpretations are wrong, please let me know. Otherwise, is there anything I can do against those errors (except for refraining from using modern JavaScript features)? Maybe, a solution could be that XWiki will use some other tool to minify JavaScript (for example "terser" or whatever). Thank you very much. |