Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-23379

Issues with Google Closure Compiler and modern JavaScript

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Unresolved
    • Major
    • None
    • None
    • None
    • None
    • Unknown

    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.

      Attachments

        Activity

          People

            Unassigned Unassigned
            rao Ralf
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: