Vanilla JS samples for ageVanilla JS samples for agent-js?

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?

Ah good point, I haven’t updated the agent js demos in ages. Try out the examples in the Dfinity/examples repo - those are up to date!

As for unpkg - I don’t use it. You’ll need to look up how to solve for the nodejs buffer pollyfill in unpkg, since one of our important dependencies unfortunately requires it

Thanks, the samples in dfinity/examples do seem to work!

I also found your auth-client demo which builds, so that gives me enough code samples to create something of my own.

Hey, sorry I havent updated the vanilla templates yet to the latest version. So if using create-ic-app you will have to choose between React/Vue/Svelte for now.