From 4826e4a2d828698f92c334460c9bc4ade0cf625b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Huan=20=28=E6=9D=8E=E5=8D=93=E6=A1=93=29?= Date: Thu, 28 Oct 2021 02:19:41 +0800 Subject: [PATCH] import at the root mod (#168) --- src/mods/mod.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/mods/mod.ts b/src/mods/mod.ts index 9be42901..f067f19f 100644 --- a/src/mods/mod.ts +++ b/src/mods/mod.ts @@ -1,3 +1,20 @@ +/** + * Huan(202110): Issue #168 - ReferenceError: Cannot access 'Puppet' before initialization + * @see https://github.com/wechaty/puppet/issues/168 + * + * We need to import `interface-of.js` before import `puppet-abstract.js` + * or we will get the following error message: + * + * ReferenceError: Cannot access 'Puppet' before initialization + at file:///home/huan/git/wechaty/puppet/src/puppet/interface-of.ts:23:48 + at ModuleJob.run (node:internal/modules/esm/module_job:175:25) + at async Loader.import (node:internal/modules/esm/loader:178:24) + at async Object.loadESM (node:internal/process/esm_loader:68:5) + + * This is due to the circler dependence, the deeper reason is still not clear. + */ +import '../puppet/interface-of.js' + import { VERSION, log,