Lucas_Werkmeister_WMDE created this task.
Lucas_Werkmeister_WMDE added projects: Wikidata, Bridge Technical Improvements.
Restricted Application added a subscriber: Aklapper.

TASK DESCRIPTION
  Since T253846: Serve modern JavaScript to modern clients 
<https://phabricator.wikimedia.org/T253846>, the Wikidata Bridge component 
serves modern (ca. ES6) JavaScript to modern clients (specifically, clients 
which support JavaScript modules). This worked out well in the initial change, 
but in an apparently unrelated change 
<https://gerrit.wikimedia.org/r/c/mediawiki/extensions/Wikibase/+/599929>, we 
ran into the problem that browser tests started failing. Chromium showed the 
following error in the console:
  
  > Uncaught SyntaxError: Unexpected token '=>'
  
  This turned out to be due to ResourceLoader’s minification of the file – 
we’re using ES6 syntax (in this case, an arrow function), but ResourceLoader’s 
JavaScriptMinifier library only supports ES5 syntax. (See also T75714: 
ResourceLoader JavaScript parser should allow ES6 syntax features  
<https://phabricator.wikimedia.org/T75714>.) And with the above change, it was 
emitting JavaScript like this:
  
    /* ... */parseWikitextPagesList(e){var 
t=e.split("\n"),r=t.pop();if(""!==r)throw new Sr("Wikitext did not end in blank 
line: ".concat(r));return t.map(e
    =>{if(!e.startsWith("*"))throw new Sr("Line does not look like a list item: 
".concat(e));/* ... */
  
  And the `=>` being at the very beginning of the line is a syntax error. 
(Firefox reports it differently, by the way: “SyntaxError: missing ) after 
argument list”.) In debug mode, the JavaScript works as expected, indicating 
that it’s ResourceLoader’s minification that causes this problem.
  
  Since our source code is already minified at build time (the results of 
which, for lack of a build step, we currently commit to Git), we want to 
completely disable ResourceLoader’s own processing of these resources, and 
ensure that it serves exactly the resources we build.

TASK DETAIL
  https://phabricator.wikimedia.org/T254261

EMAIL PREFERENCES
  https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: Lucas_Werkmeister_WMDE
Cc: Aklapper, Lucas_Werkmeister_WMDE, darthmon_wmde, Michael, Nandana, Lahi, 
Gq86, GoranSMilovanovic, QZanden, LawExplorer, _jensen, rosalieper, Scott_WUaS, 
Wikidata-bugs, aude, Lydia_Pintscher, Mbch331
_______________________________________________
Wikidata-bugs mailing list
Wikidata-bugs@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs

Reply via email to