Closed
Description
The default webpack.config.js
injects the canister ID in the build as an environment variable. This is not ideal for the following reasons:
- It incites users to actually use the canister ID in the frontend build, effectively baking the value in and preventing the module from being deployed in different environments, as it is unlikely the newly created canisters will receive the same canister ID.
- It prevents anyone from building the frontend code with e.g.
npm run build
before the canisters have been created, since the default config will (try to) load the canister IDs from.dfx/<network>/canister_ids.json
(a file and filepath which are, AFAICT, undocumented).
In the internet identity dapp we work around this by
- Not baking in the canister ID, but instead read it from the canister itself
- Only reading the local
canister_ids.json
file when a local development server is started
I think those are good practices, maybe they could be added to the default generated canisters and examples?
Metadata
Metadata
Assignees
Labels
No labels