core: watcher: fix hydrojudge hot-reload

This commit is contained in:
undefined committed 2022-09-29 16:07:22 +08:00
1 parent db0bcbac8f
commit f77dd8dc98
1 file changed
+2 -1
+2 -1
View File
@@ -152,10 +152,11 @@ export default class Watcher extends Service {
for (const filename in require.cache) {
const module = require.cache[filename];
const plugin = unwrapExports(module.exports);
if (!(typeof plugin === 'object' && 'apply' in plugin)) continue;
const runtime = this.ctx.registry.get(plugin);
if (!runtime || this.declined.has(filename)) continue;
pending.set(filename, runtime);
if (!plugin?.['sideEffect']) this.declined.add(filename);
if (!(plugin && 'sideEffect' in plugin && plugin['sideEffect'])) this.declined.add(filename);
}
for (const [filename, runtime] of pending) {