Skip to content

Commit

Permalink
Merge pull request #3558 from dfinity/jessiemongeon1-patch-2
Browse files Browse the repository at this point in the history
fix: webpack env variables
  • Loading branch information
jessiemongeon1 authored Oct 1, 2024
2 parents 28d669c + 2b5809f commit d2ad58b
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ module: {
If your application does not use `dfx` to run your build script, you can provide the variables yourself. For example:

```
DFX_NETWORK=ic NODE_ENV=production HELLO_CANISTER_ID=rrkah... npm run build
export DFX_NETWORK=ic
export NODE_ENV=production
export HELLO_CANISTER_ID=j2o3j-fiaaa-aaaab-qbifa-cai
npm run build
```

### Ensuring Node.js is available in a project
Expand Down Expand Up @@ -64,7 +67,7 @@ You may want to use a bundler other than webpack. Per-bundler instructions are n

- #### Step 4: Modify `declarations/<canister_name>/index.js` and replace `process.env.<CANISTER_NAME>_CANISTER_ID` with the equivalent pattern for environment variables for your bundler.

    - Alternately, hardcode the canister ID if that is your preferred workflow.
Alternately, hardcode the canister ID if that is your preferred workflow.

- #### Step 5: Commit the declarations and import them in your codebase.

Expand Down Expand Up @@ -146,4 +149,4 @@ function addElement () {

- #### Step 8: Refresh the browser or wait for it to refresh on its own to see your change.

When you are done working on the frontend for your project, you can stop the webpack development server by pressing `Control-C`.
When you are done working on the frontend for your project, you can stop the webpack development server by pressing `Control-C`.

0 comments on commit d2ad58b

Please sign in to comment.