Create IC App - Templates for React/Vue/Svelte based on ViteJS

I’m still finishing up my blog post, but here’s a draft of my explanation of the 0.7.7 changes and their rationale: Dfx 0.7.7 Changes | Kyle Peacock's website

2 Likes

That was super helpful! Looking forward to seeing all of it. I ran the copy task and got my folder.

Basically, it looks like the idl_factory isn’t exposed from index.js any more, which was the issue. I was able to deduce how to use the exposed createActor method to pass in the options that I wanted.

1 Like

The environment variables are throwing me for a bit of a loop. Does dfx deploy --network ic flip the environment behind the scenes to production? Things worked before, but I’m not sure how. I think i just had my local and ic defined for each canister in .dfx/local/canister_ids.json and things ‘just worked’. Now I’m at a bit of a loss. I see in webpack you have the initiateCanisterIds, but when I try to copy that over to my vite.config.js I always seem to get production values.

When I try to serve the dev version It seems to get the right values, but the app fails on export const canisterId = process.env.MY_CANISTER_ID; because the process doesn’t exist.

I guess I’ll hard code them for now. :frowning:

Any reason you can’t expose the agent and idlFactory from index.js? I’d like to call fetchroot manually if I need to(I check window for localhost and call it if necessary since I can’t bend the environment variables to my will due to my inexperience with vite).

The idlfactory is still available in the .did file, but we could export it from the index as well

1 Like

Hey, Im gonna put some time on this today to see if I can get it working with the latest version.

1 Like

I have it working with a few modifications…feel free to ping me if you get stuck. I basically just manually edited the index.js to expose the IDL and kept the method I was using to fetch the root for the agent and use a hard-coded set of canister IDs if I’m browsing localhost.

1 Like

Checking back in - @skilesare I think you’d be interested in the Minimal Update section I added to my blog post

1 Like

I got it working for dev. Just need to spend some time on the env settings & making sure it works in prod seemlessly. But expect an update within next few days.

3 Likes