Skip to content

Commit

Permalink
Lazy load external libraries, activation time is now 3ms in MacOSM1 🎉
Browse files Browse the repository at this point in the history
  • Loading branch information
ritwickdey committed Aug 30, 2022
1 parent 83baf19 commit 1c9fc20
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@
"vsls": "^0.3.967"
},
"announcement": {
"onVersion": "5.7.5",
"message": "[NEW] [email protected].5: Changed extension activationEvents to onStartupFinished."
"onVersion": "5.7.8",
"message": "[NEW] [email protected].8: Improved activation load time"
}
}
8 changes: 3 additions & 5 deletions src/LiveServerHelper.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
'use strict';
const liveServer = require('live-server');
const httpShutdown = require('http-shutdown');

export class LiveServerHelper {

static StartServer(params, callback) {
setTimeout(() => {
try {
let ServerInstance = liveServer.start(params);
let ServerInstance = require('live-server').start(params);
setTimeout(() => {

if (!ServerInstance._connectionKey) {
return callback({});
}

httpShutdown(ServerInstance);
require('http-shutdown')(ServerInstance);
return callback(ServerInstance);

}, 1000);
Expand All @@ -34,7 +32,7 @@ export class LiveServerHelper {
// callback(); /*only Working first time, Unknown Bug*/
});
LiveServerInstance.close();
liveServer.shutdown();
// liveServer.shutdown();
setTimeout(() => { callback(); }, 1000);
}
}

0 comments on commit 1c9fc20

Please sign in to comment.