Skip to content

Commit a0e7c4c

Browse files
committed
Added env path
1 parent 6b6394b commit a0e7c4c

File tree

4 files changed

+4
-7
lines changed

4 files changed

+4
-7
lines changed

.env.example

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
BASE_PATH=/Next.js-and-GitHub-Pages-Example

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,5 @@ yarn-error.log*
3333

3434
# typescript
3535
*.tsbuildinfo
36+
37+
.env

next.config.mjs

-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
* @type {import('next').NextConfig}
33
*/
44
const nextConfig = {
5-
publicRuntimeConfig: {
6-
basePath: "/Next.js-and-GitHub-Pages-Example",
7-
},
85
output: "export",
96
images: {
107
loader: "akamai",

pages/index.tsx

+1-4
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,8 @@ import type { NextPage } from "next";
22
import Head from "next/head";
33
import Image from "next/image";
44
import styles from "../styles/Home.module.css";
5-
import getConfig from "next/config";
65

76
const Home: NextPage = () => {
8-
const { publicRuntimeConfig } = getConfig();
9-
107
return (
118
<div className={styles.container}>
129
<Head>
@@ -65,7 +62,7 @@ const Home: NextPage = () => {
6562
Powered by{" "}
6663
<span className={styles.logo}>
6764
<Image
68-
src={`${publicRuntimeConfig.basePath}"/vercel.svg"`}
65+
src={`${process.env.BASE_PATH}/vercel.svg`}
6966
alt="Vercel Logo"
7067
width={72}
7168
height={16}

0 commit comments

Comments
 (0)