This issue has been created
 
 
XWiki Platform / cid:jira-generated-image-avatar-6c95503d-8a62-4d55-9407-bc27e422126f XWIKI-23379 Open

Issues with Google Closure Compiler and modern JavaScript

 
View issue   ยท   Add comment
 

Issue created

 
cid:jira-generated-image-avatar-3f9e89da-e8b2-44e3-a0a7-fedd0fe3d1c8 Ralf created this issue on 15/Jul/25 09:50
 
Summary: Issues with Google Closure Compiler and modern JavaScript
Issue Type: cid:jira-generated-image-avatar-6c95503d-8a62-4d55-9407-bc27e422126f Improvement
Assignee: Unassigned
Created: 15/Jul/25 09:50
Priority: cid:jira-generated-image-static-major-29b12e5e-d8b3-4767-94aa-434626150be8 Major
Reporter: Ralf
Description:

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://localhost:8080/xwiki/bin/jsx/xwiki-tools/WebHome?language=en&docVersion=59.4] ERROR c.x.x.w.s.JsExtension          - Error at line [50], column [11]: [Parse error. 'identifier' expected]
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.