-
Notifications
You must be signed in to change notification settings - Fork 89
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
ESM support will be required after Wechaty v0.69+ #96
Comments
I am adapting ESM for PadLocal now, feeling a little confused by following questions:
|
Thanks for asking! Here are my thoughts on those questions:
The ESM is the next version of the Node.js ecosystem modulized system specification, it comes with lots of benefits and will eventually replace all the old ones like CJS, AMD, UMD, etc, and the community is strongly suggested to head to it as soon as possible. For Wechaty, it can make our JS code clean and more effective, and most important, follow the latest community standard.
Yes, we can. The only downside of a PURE ESM module is that it can not be used by other CJS modules anymore. For the Wechaty community especially with the v1.x, it will be OK because Wechaty is running under ESM mode by default.
Yes, the DUAL model means that when the model is running under CJS mode, it can be |
DONE! Pelease checkout [email protected] |
Currently, the Wechaty ecosystem is moving from CommonJS to ES Modules.
The Wechaty will be Dual-ESM-CJS-Module supported, and the default mode will be under ESM.
In order to load Wechaty Puppet under ESM mode by setting the environment variable
WECHATY_PUPPT
, or by setting theoptions.puppet = 'wechaty-puppet-xxx'
, the puppet provider NPM module must support ESM.If the puppet does not support ESM, then the Wechaty will run into the below issue: TypeError: MyPuppet is not a constructor
Link to: wechaty/puppet#148
P.S. I would love to send a PR to convert padlocal to ESM, if we can have all the unit tests passed and made the GitHub Action green.
The text was updated successfully, but these errors were encountered: