title: TypeError: Cannot read properties of undefined (reading 'call') on build but not dev
body: <p>I am running a <code>vite.js</code> app with web3 installed.
  When I run the app in dev mode, all works fine but when I run it in production mode (build) it fails with:
  <code>&quot;TypeError: Cannot read properties of undefined (reading 'call')&quot;</code>.</p>
  <p>I can confirm that the error comes from the contract method generated from my ABI:
  contract.methods.isOwner(sender)<code>.call</code>({from: sender}, function (err, res)</p>
  <p>If I comment this line out I wont get the error.</p>
  <p>You can reproduce the error by using my test repo:
  download my test repo:
  <a href="https://github.com/nybroe/web3_vite_call_of_undefined/tree/main" rel="nofollow noreferrer">https://github.com/nybroe/web3_vite_call_of_undefined/tree/main</a></p>
  <p>follow the readme with repo steps:</p>
  <p><strong>setup:</strong></p>
  <ol>
  <li>download the repro</li>
  <li>navigate to &quot;app&quot;</li>
  <li>npm install</li>
  </ol>
  <p><strong>dev test (which works)</strong></p>
  <ol>
  <li>npm run dev</li>
  <li>check the console - no errors</li>
  </ol>
  <p><strong>build test (which breaks)</strong></p>
  <ol>
  <li>npm run build</li>
  <li>npm run preview</li>
  <li>check the console - you will see the following errors: &quot;TypeError: Cannot read properties of undefined (reading 'call')&quot;</li>
  </ol>