MioQuispe / create-ic-app

Use your favourite frontend framework with the Internet Computer
186 stars 42 forks source link

react sample can't find counter.did.js - (workaround provided) #28

Open augchan42 opened 9 months ago

augchan42 commented 9 months ago

The counter.did.js file can't be found under ../.dfx/local/canisters/counter. I tried react+javascript and react+typescript. Seems the build needs to include dfx generate.

I had to: 1) generate the candid interfaces manually using dfx generate. 2) Update the App.jsx file with the proper import:

import * as counter from "../src/declarations/counter"

Stderr: Could not resolve './counter.did.js' from .dfx/local/canisters/counter/index.js error during build: Error: Could not resolve './counter.did.js' from .dfx/local/canisters/counter/index.js at error (/home/hosermage/projects/dfinity/create-ic-app/ledger_sample_react/node_modules/rollup/dist/shared/rollup.js:198:30) at ModuleLoader.handleResolveId (/home/hosermage/projects/dfinity/create-ic-app/ledger_sample_react/node_modules/rollup/dist/shared/rollup.js:22464:24) at /home/hosermage/projects/dfinity/create-ic-app/ledger_sample_react/node_modules/rollup/dist/shared/rollup.js:22427:26

amva13 commented 7 months ago

just noting -- I ran into the same issue (same fix).

In my case, also needed to run

yarn add @dfinity/candid

theofandrich commented 7 months ago

Did the counter actually work? I just did this, got the web page and everything to load, but it's not hitting the backend canister with the counter logic.