Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

Web3 default import does not work with commonjs #5196

@nazarhussain

Description

@nazarhussain

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

Web3 is not a constructor

Expected Behavior

It should work fine.

Steps to Reproduce

const Web3 = require('web3'); 

const web3 = new Web3(); 

Web3.js Version

4.x

Environment

No response

Anything Else?

Replacing export default with export = can fix this issue but it's not possible when exporting multiple items from the module which we are.

Metadata

Metadata

Labels

4.x4.0 relatedBugAddressing a bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions