Skip to content

Vite + Web3 : "TypeError: Cannot read properties of undefined (reading 'call')" #7938

Answered by tony19
nybroe asked this question in Q&A
Discussion options

You must be logged in to vote

Using the pre-bundled web3 script seems to workaround the problem:

// vite.config.js
import { defineConfig } from 'vite'

export default defineConfig({
  
  resolve: {
    alias: {
      web3: 'web3/dist/web3.min.js',
    },

    // or
    alias: [
      {
        find: 'web3',
        replacement: 'web3/dist/web3.min.js',
      },
    ],
  },
})

Replies: 7 comments 11 replies

Comment options

You must be logged in to vote
1 reply
@nybroe
Comment options

Comment options

You must be logged in to vote
6 replies
@tnkerer
Comment options

@TheoOliveira
Comment options

@chendind
Comment options

@cfmj
Comment options

@billal-fahmid
Comment options

Answer selected by nybroe
Comment options

You must be logged in to vote
2 replies
@andr3medeiros
Comment options

@cfmj
Comment options

Comment options

You must be logged in to vote
1 reply
@mcclux
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@tnkerer
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Converted from issue

This discussion was converted from issue #7937 on April 28, 2022 07:37.