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 typescript definition has no default export #1248

@nicolaslawdune

Description

@nicolaslawdune

Hello,

Web3 Typescript definition on branch 1.0 doesn't contain "default export".

Context

  • Typescript version : 2.6.2
  • Converting ES2015(ES6) to ES5

After importing :
import Web3 from 'web3';

Compilation Error

Module '"xxxx/node_modules/web3/index"' has no default export.

Update 1

After importing like this import Web3 = require('web3'); I got a compilation error :

error TS1202: Import assignment cannot be used when targeting ECMAScript modules. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from
"mod"', or another module format instead.

This error is due to Module mode from tsconfig which is ES6.

Update 2

I remove module mode from tsconfig and it works now.

Metadata

Metadata

Assignees

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