I’m trying to create a webapp with an option to login using your Internet Identity and read and write some data to the internet computer. Therefore I need to use agent-js.
I’ve tried existing examples, but they all give me errors.
Samples here: agent-js/demos at main · dfinity/agent-js · GitHub
Returns an error when running npm run build:
ERROR in ./src/main.js 3:0-50 Module not found: Error: Can't resolve '@dfinity/auth-client' in '/home/michiel/agent-js/demos/sample-javascript/src'
The samples at GitHub - MioQuispe/create-ic-app also didn’t work.
They give the following error:
[load-fallback] Could not load /home/michiel/create-ic-app/template-vanilla/.dfx/local/canisters/counter/counter.js (imported by src/agent.js): ENOENT: no such file or directory, open '/home/michiel/create-ic-app/template-vanilla/.dfx/local/canisters/counter/counter.js'
I’m not a frontend developer, but normally I get things to work. This time, I’m totally lost.
Is there a way to use agent-js with vanilla js?
And then preferably with REAL vanilla js, so no npm, vite, webpack, vue, react etc. But that option might not be available, so then only npm?
I’m running node version 16.9.1
npm version 7.24.0
Running on Ubuntu 20
I have tried loading the module using unpkg, this is my preffered way:
script type="module" src="https://unpkg.com/@dfinity/agent@0.10.0/lib/esm/index.js"
but that also returns an error:
Failed to resolve module specifier “buffer/”. Relative references must start with either /
What are my options? How do I get this to work?