Connecting from local to mainnet

I try to prepare everything for non-rust-savvy and not-too-icp-savvy frontend devs to continue wire their react app with a canister.

I have a setup where it works on my machine So on a local network with a local canister i can run npm run dev with ic2connect and everything works.

However, I cannot wire the local react app (using vite ic2connect and a lot of defaults) to run against a mainnet canister.

Somehow it keeps connecting to local and I wonder what I’m doing wrong. The documentation is somewhat sparse. I set all kinds of env vars.

GitHub - deep-ink-ventures/blend-safe is my repo.

I as well have a __dirname error on deploying the frontend to a canister, but haven’t looked into that yet and have some ideas on how to debug it already, but if someone came across that it would save me some hours

Okay, so I needed to adjust the vite.config.js that didn’t know about “playground”.

Hey @deep-ink-ventures,

Thank you for the update and great that you figured it out!
How did you initiate your project, i.e. where did you get the vite.config.js from?

Edit: I assume you used GitHub - MioQuispe/create-ic-app: Use your favourite frontend framework with the Internet Computer which is a bit dated.

For Rust/React I’d suggest

Here’s a simple example based on the former that also works fine on the Playground: GitHub - domwoe/simple-reddit-clone: A very simple Reddit Clone on the Internet Computer

We’ll also (hopefully soon) release a new version of dfx new with a wizard to customize the initial project.