Node.js fully supports ECMAScript modules as they are currently specified and provides interoperability between them and its original module format, CommonJS.
Newer build tools like Vite expect libraries to support ESM exports. Not having ESM and only exporting to CJS, needs a workaround to use the library like so:
Can we add support for ESM for agora-token?
ECMAScript modules are the official standard format to package JavaScript code for reuse. Modules are defined using a variety of import and export statements.
Node.js fully supports ECMAScript modules as they are currently specified and provides interoperability between them and its original module format, CommonJS.
Newer build tools like Vite expect libraries to support ESM exports. Not having ESM and only exporting to CJS, needs a workaround to use the library like so:
Using a named import from the package might work in dev, but would break in production builds:![image](https://user-images.githubusercontent.com/10047883/229123666-3e412b20-0d13-4cea-93ae-7806bde360fd.png)