热重载需要在停机后清空lib以下目录的缓存,以便之后重新require导入
This commit is contained in:
parent
9acec82bd6
commit
cf209f37c2
|
|
@ -87,6 +87,12 @@ const restart = async () => {
|
|||
if (shutdown) {
|
||||
await shutdown();
|
||||
}
|
||||
// 清空lib以下目录的缓存
|
||||
Object.keys(require.cache).forEach(function (key) {
|
||||
if (key.includes('lib')) {
|
||||
delete require.cache[key];
|
||||
}
|
||||
});
|
||||
const pwd = process.cwd();
|
||||
const simpleConnector = require('../lib/config/connector').default;
|
||||
console.warn('----> Starting service......');
|
||||
|
|
|
|||
Loading…
Reference in New Issue