Skip to content

Commit

Permalink
Added env path
Browse files Browse the repository at this point in the history
  • Loading branch information
DaveAldon committed Apr 23, 2024
1 parent 6b6394b commit a0e7c4c
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 7 deletions.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
BASE_PATH=/Next.js-and-GitHub-Pages-Example
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,5 @@ yarn-error.log*

# typescript
*.tsbuildinfo

.env
3 changes: 0 additions & 3 deletions next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
* @type {import('next').NextConfig}
*/
const nextConfig = {
publicRuntimeConfig: {
basePath: "/Next.js-and-GitHub-Pages-Example",
},
output: "export",
images: {
loader: "akamai",
Expand Down
5 changes: 1 addition & 4 deletions pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@ import type { NextPage } from "next";
import Head from "next/head";
import Image from "next/image";
import styles from "../styles/Home.module.css";
import getConfig from "next/config";

const Home: NextPage = () => {
const { publicRuntimeConfig } = getConfig();

return (
<div className={styles.container}>
<Head>
Expand Down Expand Up @@ -65,7 +62,7 @@ const Home: NextPage = () => {
Powered by{" "}
<span className={styles.logo}>
<Image
src={`${publicRuntimeConfig.basePath}"/vercel.svg"`}
src={`${process.env.BASE_PATH}/vercel.svg`}
alt="Vercel Logo"
width={72}
height={16}
Expand Down

0 comments on commit a0e7c4c

Please sign in to comment.