You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importReact,{Component,useEffect,useState}from'react';import{render}from'react-dom';functionApp(){const[info,setInfo]=useState(null);const[cardanoAddresses,setCardanoAddresses]=useState(null);constaddr='addr1gqtnpvdhqrtpd4g424fcaq7k0ufuzyadt7djygf8qdyzevuph3wczvf2dwyx5u';useEffect(()=>{import('cardano-addresses/dist/cardano-addresses.esm.js').then((mod)=>{console.log('imported cardano-addresses module',mod);setCardanoAddresses(mod);});},[]);useEffect(()=>{if(cardanoAddresses){console.log('init',{ addr, cardanoAddresses });cardanoAddresses.inspectAddress(addr).then((info)=>{console.log('address info is:',info);setInfo(info);}).catch((e)=>{setInfo(e.message);});}},[cardanoAddresses]);return(<div><h4>cardano-address-react sample</h4><p>{JSON.stringify(info)}</p></div>);}render(<App/>,document.getElementById('root'));
The import of cardano-addresses/dist/cardano-addresses.esm.js succeedes, but as soon as I call the cardanoAddresses.inspectAddress(addr) function, I get the error ./cardano-addresses-jsapi.cjs.js: ES module loading failed!.
Any advice would be really appeciated!
The text was updated successfully, but these errors were encountered:
Version
3.6.0 - Browser
Expectation
I should be able to import the module with a bundler like webpack.
The online demo shows how to import the cardano-addresses module served from a webserver root.
Actual Behaviour
Unfortunately I am not able to reproduce the sample in this stackblitz example.
The import of
cardano-addresses/dist/cardano-addresses.esm.js
succeedes, but as soon as I call thecardanoAddresses.inspectAddress(addr)
function, I get the error./cardano-addresses-jsapi.cjs.js: ES module loading failed!
.Any advice would be really appeciated!
The text was updated successfully, but these errors were encountered: