I'm trying to use version 4.0.0 of truffle-contract in a browser app, so no NodeJS, no require or anything. So I followed the instructions in the doc, downloaded truffle-contract in non-minified format from https://cdn.jsdelivr.net/npm/truffle-contract@4.0.0/dist/truffle-contract.js, downloaded the latest version of ethers.js from https://cdn.jsdelivr.net/npm/ethers@4.0.20/dist/ethers.min.js, added the script tags in my HTML page:

<script src="js/web3.min.js"></script>
<script src="js/ethers.min.js"></script>
<script src="js/truffle-contract.js"></script>
<script src="js/app.js"></script>

but now when I load the page, I get the following error:

Uncaught TypeError: EthersAbi is not a constructor
at Object.74.ethers/utils/abi-coder (truffle-contract.js:14737)
at o (truffle-contract.js:1)

Is there any other dependency that is not documented, or does truffle-contract depend on another version of ethers.js?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.