You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
viem can't be used in a CJS module. I'd say that this is important for its adoption, as it's the default on node.
If you try to do it you get this error:
pato@lucille:v% node -e 'require("viem")'
node:internal/modules/cjs/loader:1269
throw err;
^
Error [ERR_REQUIRE_ESM]: require() of ES Module /private/tmp/v/node_modules/viem/dist/index.js from /private/tmp/v/[eval] not supported.
Instead change the require of index.js in /private/tmp/v/[eval] to a dynamic import() which is available in all CommonJS modules.
at [eval]:1:1
at Script.runInThisContext (node:vm:129:12)
at Object.runInThisContext (node:vm:307:38)
at [eval]-wrapper:6:22 {
code: 'ERR_REQUIRE_ESM'
}
Node.js v18.13.0
I think ideally viem should use package.json#exports to support both ESM and CJS.
The text was updated successfully, but these errors were encountered:
This issue has been locked since it has been closed for more than 14 days.
If you found a concrete bug or regression related to it, please open a new bug report with a reproduction against the latest Viem version. If you have any questions or comments you can create a new discussion thread.
viem can't be used in a CJS module. I'd say that this is important for its adoption, as it's the default on node.
If you try to do it you get this error:
I think ideally viem should use
package.json#exports
to support both ESM and CJS.The text was updated successfully, but these errors were encountered: