I got the existing app.js file as is to work with Metamask by using the following script lines inserted after the meta tags in the html header section:
<!-- The legacy-web3 script must run BEFORE your other scripts. -->
<script src="https://unpkg.com/@metamask/legacy-web3@latest/dist/metamask.web3.min.js"></script>
<!-- Or: -->
<script src="https://unpkg.com/@metamask/legacy-web3@latest/dist/metamask.web3.js"></script>
This prevented me from having to refactor to use the new ethereum provider.
I got the existing app.js file as is to work with Metamask by using the following script lines inserted after the meta tags in the html header section:
This prevented me from having to refactor to use the new ethereum provider.