Superheroes: Import Error in CRUD + React, using dfx 0.8.4

Hi all,

Beginner here.

I’m trying to get this repo from Enzo working on my machine.

It’s a basic CRUD + React app, which is great for getting started, but it looks like it was built using dfx 0.6.4, and I’m on dfx 0.8.4.

I don’t know if that’s the problem, though.

Last commit was Sept. 1, 2020, so I’m guessing a lot has changed.

After successfully running

npm install
dfx start
dfx canister create --all

I am trying

dfx build

and running into an errors.

I fixed one error by changing this line:

public type SuperheroId = Word32;


public type SuperheroId = Nat32;

Guessing that’s a change in Motoko.

After that, I am getting another error in each of the CRUD components on this import:

import Superheroes from 'ic:canisters/superheroes';

    ERROR in ./src/www/components/create.jsx
    Module not found: Error: Can't resolve 'ic:canisters/superheroes' in '/Users/steve/projects/ic/superheroes/src/www/components'
     @ ./src/www/components/create.jsx 9:0-51 25:4-15
     @ ./src/www/index.jsx

If anyone is familiar with this app, or recognizes that sort of import error, generally, and has any ideas, I would be most appreciative!




FWIW, I’m guessing this has something to with this:

Seems there are a lot of changes in dfx 0.8.0 vs older versions to do with Candid, declarations, etc.

I wonder if it’s better to start with a different template for integrating with React.

I’m currently looking at this from Kyle: