Skip to content

Mixing of ESM and CJS dependencies #8679

@nazarhussain

Description

@nazarhussain

Nodejs does allow cjs and esm codebase only with synchronous require.

The CommonJS module require currently only supports loading synchronous ES modules (that is, ES modules that do not use top-level await).

Modern version of Vitest test to fully base on nodejs module resolution so causing this error.

Error: require() cannot be used on an ESM graph with top-level await. Use import() instead. To see where the top-level await comes from, use --experimental-print-required-tla.
  From /lodestar/node_modules/@ethereumjs/ethash/dist/util.js 
  Requiring /lodestar/node_modules/bigint-crypto-utils/dist/index.node.esm.js 

The reason is the use of very old version of @@ethereumjs/* packages in the prover package.

"@ethereumjs/block": "^4.2.2",
"@ethereumjs/blockchain": "^6.2.2",
"@ethereumjs/common": "^3.1.2",
"@ethereumjs/rlp": "^4.0.1",
"@ethereumjs/trie": "^5.0.5",
"@ethereumjs/tx": "^4.1.2",
"@ethereumjs/util": "^8.0.6",
"@ethereumjs/vm": "^6.4.2",

The above issue can be fixed by upgrading these packages.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions