I did this upgrade and also upgraded new packages via NPM. @dfinity/agent - npm 0.9.3 looks in .dfx/local/canisters/CANISTERNAME/CANISTERNAME.js
But it seems that 0.8.0 builds .dfx/local/canisters/CANISTERNAME/index.js, which results in @dfinity/agent not being able to find CANISTERNAME.js . Which is a build error.
@peterparker That actually does not resolve it. The issue I am having is with the Node module @dfinity/agent . My code is not having an issue with the upgrade, the imported module is.
It should be updated so it works with 0.8.0. So if I do ‘npm install @dfinity/agent’ on a brand new project created using dfx 0.8.0, currently it will throw an error because it is looking in the wrong place.
I used the same starter and I have the same node version. I did the steps you mentioned. However, it looks like we are missing the canisterId when the exports occurs.
Any idea what is going on?
'canisterId' is not exported by .dfx/local/canisters/counter/counter.did.js, imported by src/agent.js
file: /home/fer/Projects/pro/overchute-app/src/agent.js:6:2
4: import {
5: idlFactory as counter_idl,
6: canisterId as counter_id,
^
7: } from "dfx-generated/counter"
error during build:
Error: 'canisterId' is not exported by .dfx/local/canisters/counter/counter.did.js, imported by src/agent.js
at error (/home/fer/Projects/pro/overchute-app/node_modules/rollup/dist/shared/rollup.js:151:30)
at Module.error (/home/fer/Projects/pro/overchute-app/node_modules/rollup/dist/shared/rollup.js:10044:16)
at Module.traceVariable (/home/fer/Projects/pro/overchute-app/node_modules/rollup/dist/shared/rollup.js:10429:29)
at ModuleScope.findVariable (/home/fer/Projects/pro/overchute-app/node_modules/rollup/dist/shared/rollup.js:9200:39)
at Identifier.bind (/home/fer/Projects/pro/overchute-app/node_modules/rollup/dist/shared/rollup.js:4572:40)
at Property.bind (/home/fer/Projects/pro/overchute-app/node_modules/rollup/dist/shared/rollup.js:2886:23)
at ObjectExpression.bind (/home/fer/Projects/pro/overchute-app/node_modules/rollup/dist/shared/rollup.js:2882:31)
at CallExpression.bind (/home/fer/Projects/pro/overchute-app/node_modules/rollup/dist/shared/rollup.js:2882:31)
at CallExpression.bind (/home/fer/Projects/pro/overchute-app/node_modules/rollup/dist/shared/rollup.js:7133:15)
at VariableDeclarator.bind (/home/fer/Projects/pro/overchute-app/node_modules/rollup/dist/shared/rollup.js:2886:23)
Remove the .did.js and you will be importing out of /<canister-name>/index.js which exports both. You will need to make sure that you have string replacement for process.env.<CANISTER_NAME>_CANISTER_ID though.
I also changed my agent.js to have them there. It is a bit different since I use hot reload with Vite serve while coding. So I have the different ids based on port.
What happens when you post yours live??
I will post this issue in the builder from Github.