Skip to content

Commit a2e2575

Browse files
committed
Fix isProd check
1 parent a39aad2 commit a2e2575

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

LEARNING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ By default, Next.js uses Node.js to run the application, which is incompatible w
77

88
Update `next.config.mjs` with the following:
99
```mjs
10-
import { PHASE_PRODUCTION_SERVER } from 'next/constants.js';
10+
import { PHASE_PRODUCTION_BUILD, PHASE_PRODUCTION_SERVER } from 'next/constants.js';
1111

1212
export default (phase) => {
13-
const isProd = phase === PHASE_PRODUCTION_SERVER;
13+
const isProd = phase === PHASE_PRODUCTION_BUILD || phase === PHASE_PRODUCTION_SERVER;
1414

1515
/** @type {import('next').NextConfig} */
1616
const nextConfig = {
@@ -30,7 +30,7 @@ export default (phase) => {
3030
3131
### 2. Add the environment variables to Github
3232
- On Github, navigate to the `Settings` tab of your project, and select `Environments` from the menu on the left-hand side.
33-
- Under `Environment secrets`, click `Add environment secret` and add `REACT_APP_ALCHEMY_API_KEY` and its value.
33+
- Select the`github-pages` environment, and under `Environment secrets`, click `Add environment secret` and add `REACT_APP_ALCHEMY_API_KEY` and its value.
3434
- Click `Add environment secret` again and add `REACT_APP_ETHERSCAN_API_KEY` and its value.
3535

3636
### 3. Activate GitHub Pages for Repository

next.config.mjs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
1-
import { PHASE_PRODUCTION_SERVER } from 'next/constants.js';
1+
import { PHASE_PRODUCTION_BUILD, PHASE_PRODUCTION_SERVER } from 'next/constants.js';
22

33
export default (phase) => {
4-
const isProd = phase === PHASE_PRODUCTION_SERVER;
5-
console.log("phase = ", phase);
6-
console.log("PHASE_PRODUCTION_SERVER = ", PHASE_PRODUCTION_SERVER);
7-
console.log("isProd = ", isProd);
4+
const isProd = phase === PHASE_PRODUCTION_BUILD || phase === PHASE_PRODUCTION_SERVER;
85

96
/** @type {import('next').NextConfig} */
107
const nextConfig = {
@@ -20,7 +17,7 @@ export default (phase) => {
2017
output: 'standalone',
2118
// Map all static assets to the project URL davidde.github.io/ethblox,
2219
// instead of the base davidde.github.io domain, but only for production:
23-
basePath: '/ethblox',
20+
basePath: isProd ? '/ethblox' : undefined,
2421

2522
async redirects() {
2623
return [

0 commit comments

Comments
 (0)