Skip to content

Commit

Permalink
dev-server.js: don't lazy load dependencies (wikimedia-gadgets#1630)
Browse files Browse the repository at this point in the history
* mw.loader.using

* fix mw.loader.using usage

Co-authored-by: Siddharth VP <[email protected]>
  • Loading branch information
NovemLinguae and siddharthvp authored Dec 26, 2022
1 parent d86a346 commit 799a31d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion scripts/dev-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const server = http.createServer(async (request, response) => {
const jsFiles = ['morebits.js', 'twinkle.js'].concat(moduleFiles.map(f => 'modules/' + f));
const cssFiles = ['morebits.css', 'twinkle.css'];

let jsCode = `mw.loader.load(['jquery.ui', 'ext.gadget.select2']);`;
let jsCode = `mw.loader.using(['jquery.ui', 'ext.gadget.select2']).then(function () {\n`;

if (process.argv[2] !== '--no-sysop') {
// Pretend to be a sysop, if not one already - enables testing of sysop modules by non-sysops
Expand All @@ -33,6 +33,7 @@ const server = http.createServer(async (request, response) => {
jsCode += `;mw.loader.addStyleTag(${css});`;
}
jsCode += `;console.log('Loaded debug version of Twinkle.');`;
jsCode += `});`; // End mw.loader.using
response.writeHead(200, { 'Content-Type': 'text/javascript; charset=utf-8' });
response.end(jsCode, 'utf-8');
});
Expand Down

0 comments on commit 799a31d

Please sign in to comment.