wechaty / getting-started

A Starter Project Template for Wechaty works out-of-the-box
https://gitpod.io/#https://github.com/wechaty/wechaty-getting-started
Apache License 2.0
797 stars 351 forks source link

TypeError: MyPuppet is not a constructor #203

Closed huan closed 3 years ago

huan commented 3 years ago

The whole Wechaty ecosystem is moving towards ES Modules and we are refactoring the modules slowly.

See:

TypeError: MyPuppet is not a constructor

The above error message means that you are trying to load a non-ESM compatible puppet module.

Please file a new issue on that puppet repo to record the problem, and a link back to this issue will be welcome.

Solution

const puppet = new PuppetPadlocal()
const bot = new Wechaty({ puppet })

The above code should work as a workaround.

huan commented 3 years ago

We have added compatible code for load CJS puppet modules in wechaty@0.73.8 or above versions.