Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ReferenceError: Cannot access 'Puppet' before initialization #168

Open
huan opened this issue Oct 27, 2021 · 0 comments
Open

ReferenceError: Cannot access 'Puppet' before initialization #168

huan opened this issue Oct 27, 2021 · 0 comments
Labels
bug Something isn't working

Comments

@huan
Copy link
Member

huan commented Oct 27, 2021

We need to import interface-of.js before importing 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 of course due to the circler dependence. However, the deeper reason is still not clear.

Need to be investigated.

Related code

const looseInstanceOfPuppet = looseInstanceOfClass(Puppet as any as Constructor<Puppet>)

return looseInstanceOfPuppet(target)

@huan huan added the bug Something isn't working label Oct 27, 2021
huan added a commit that referenced this issue Oct 27, 2021
huan added a commit that referenced this issue Oct 27, 2021
huan added a commit that referenced this issue Oct 27, 2021
* workaround for (#168)

* refactor export names

* import at the root mod (#168)

* fix pack testing

* 0.53.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant