Closed so1ve closed 1 year ago
Thanks for your interest! I think the CJS build is already provided (see https://github.com/doodlewind/nativebird/blob/main/scripts/build.cjs#L11), but I'm not sure if all related setups work. I'm open to related fixes.
Ah, thanks for pointing it out! I missed that part 😢
One more question: there is type: module
in package.json 🤔 , does it prevents users to require()
this package?
To my knowledge, in this case Node will treat the package as an ES6 module, but if a user tries to require()
it in a CommonJS context, Node will attempt to load it as a CommonJS module. And that's why we need the .cjs
suffix to distinguish between them.
Anyway it's just in theory, feel free to try it out locally!
Thanks for your explanation!
谢谢雪碧佬 =v=
Though esm is the future of JavaScript, there are still many projects using cjs. If we can use nativebird in cjs (such as hexo - to drop bluebird) it would be fantastic.
If you like I can send a pr.