Its based on ViteJS so you get hot module reloading etc. out of the box and its not very opinionated. It uses a regular dev server while you’re developing (for speed) and when you are finished you can deploy the frontend to the IC. Comes with an example Counter canister.
At the moment React, Vue & Svelte are supported. Lemme know if there’s any issues or question marks.
There seem to be require statements in the esm version of @dfinity/agent which are causing this issue… for some reason they get compiled away in the react version (so react-ts version doesn’t have this problem) but they shouldn’t be there in the first place. Would be great if that could be fixed for future versions. I’ll see if I can get a workaround for it in the meantime.
I added a temporary fix which patches @dfinity/agent automatically after running npm install.
This is done automatically for new projects, but since you already have one:
See here:
Move the patches dir and its contents to your project root
Change package.json to add patch-package in devDependencies and add the scripts > “postinstall”, it should be run automatically when you do npm i
Ive updated all the versions since there was a problem on some machines.
Make sure you get the latest SDK version if you use this
DFX_VERSION=0.7.0-beta.8 sh -ci "$(curl -fsSL https://sdk.dfinity.org/install.sh)"
Also removed the unnecessary patch since its not required anymore.
As always, let me know if you run into issues or find something confusing (I don’t bite).
The repo is also open for PRs if you want to contribute your own templates or find something that could be improved!
I have a question on accessing the built project using the canister id. When I npm run dev and use the localhost:3000 to access the site. I am able to see the page and access the counter method.
However, when I access the site using the canister id. I get the following error:
Details: ReplicaError { reject_code: 3, reject_message: “IC0302: Canister ryjl3-tyaaa-aaaaa-aaaba-cai has no query method ‘http_request’” }
Hey that’s strange, I haven’t encountered that. Let me see if I get the same problem. Also can you tell me what version of @dfinity/agent your package version says.