I already have a React built frontend that I want to use for the ic, but I have problems linking it correctly.
My project contains a
build/ directory with an
This is my dfx.json:
dfx it builds find on local and tungsten network and installation also runs without an error.
But opening the canister in the browser throws an error:
An error happened:
Error: Query failed:
Message: not found
at r.retrieve (https://4zrvx-mypaa-aaaaa-aaaaa-aaaaa-aaaaa-aaaaa-q.ic0.app/bootstrap.js:2:43726)
at async _loadJs (https://4zrvx-mypaa-aaaaa-aaaaa-aaaaa-aaaaa-aaaaa-q.ic0.app/bootstrap.js:2:241980)
at async _main (https://4zrvx-mypaa-aaaaa-aaaaa-aaaaa-aaaaa-aaaaa-q.ic0.app/bootstrap.js:2:242870)
I am not quite sure what is wrong with the config. Would be great if somebody can help out here
Point the entry point in dfx.json at this react index.jsx file.
There’s a great example react project here:
Or the tutorials include some too:
Thx I’ll check that out. Though the docs state that you can use your own html file as entry point here, which I would like to do.
I’m running into the same thing.
Currently, the bootstrap server only retrieves one entrypoint file, but I have a large webpack bundle with many chunks. I tried limiting it to a single chunk of 13mb, but that takes about 20s to download
Another question: I’m using React router, and I’m not sure how to handle routing (eg. vercel has custom routes). One solution would be to run my own nginx in front, I guess.
pinging @hansl @andrew_DFN
@wang Have you tried using a HashRouter for routing based on
window.location.hash https://reactrouter.com/web/api/HashRouter . I think it should work, but haven’t tried it yet.