mirror of
https://github.com/thinkjs/thinkjs.git
synced 2026-01-25 14:42:47 +00:00
feature: support preload packages before start server
This commit is contained in:
parent
a549ee4f7e
commit
85d39fa007
@ -13,7 +13,7 @@ export default {
|
||||
app: `${rootPath}core${sep}app.js`,
|
||||
http: `${rootPath}core${sep}http.js`,
|
||||
view: `${rootPath}core${sep}view.js`,
|
||||
auth: `${rootPath}util${sep}auth.js`,
|
||||
// auth: `${rootPath}util${sep}auth.js`,
|
||||
cookie: `${rootPath}util${sep}cookie.js`,
|
||||
validator: `${rootPath}util${sep}validator.js`,
|
||||
await: `${rootPath}util${sep}await.js`,
|
||||
|
||||
16
src/index.js
16
src/index.js
@ -432,12 +432,26 @@ export default class {
|
||||
|
||||
think.autoCompile = true;
|
||||
}
|
||||
/**
|
||||
* pre require
|
||||
* @return {} []
|
||||
*/
|
||||
preload(){
|
||||
let startTime = Date.now();
|
||||
for(let name in thinkData.alias){
|
||||
think.require(thinkData.alias[name]);
|
||||
}
|
||||
think.log('preload packages finished', 'PRELOAD', startTime);
|
||||
}
|
||||
/**
|
||||
* run
|
||||
* @return {} []
|
||||
*/
|
||||
run(){
|
||||
run(preload){
|
||||
this.start();
|
||||
if(preload){
|
||||
this.preload();
|
||||
}
|
||||
return think.require('app').run();
|
||||
}
|
||||
/**
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user