Skip to content

Commit 6031d66

Browse files
committed
Prefix env var with NEXT_PUBLIC_ to enable replacement
1 parent 7099f77 commit 6031d66

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

components/meta/gtag.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import Script from 'next/script';
22

3-
const GTAG_ID = process.env.GTAG_ID || 'GTM-MXDVTH6';
3+
const GTAG_ID = process.env.NEXT_PUBLIC_GTAG_ID || 'GTM-MXDVTH6';
44
const gtag = () => (
55
<Script
66
strategy="afterInteractive"

components/meta/meta.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ import Head from 'next/head';
33
import { TMPropsMeta } from './metaType';
44

55
const Meta = (props: TMPropsMeta) => {
6-
const authorName = process.env.AUTHOR_NAME ?? 'junekimdev';
7-
const siteName = process.env.SITE_NAME ?? "another junekimdev's website";
8-
const homeUrl = process.env.PUBLIC_URL ?? 'localhost:3000';
6+
const authorName = 'junekimdev';
7+
const siteName = "another junekimdev's website";
8+
const homeUrl = process.env.NEXT_PUBLIC_PUBLIC_URL ?? 'localhost:3000';
99
const {
1010
image = `${homeUrl}/assets/images/LogoPlace_Extended_1200x627.png`,
1111
imageWidth = '1200',

next.config.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ module.exports = {
22
// @see https://nextjs.org/docs/api-reference/next.config.js/environment-variables
33
// This sets environment variable for SSR
44
env: {
5-
PUBLIC_URL: process.env.PUBLIC_URL,
6-
// CMS_URL: process.env.CMS_URL,
7-
// GTAG_ID: process.env.GTAG_ID,
8-
API_URL: process.env.API_URL,
5+
NEXT_PUBLIC_PUBLIC_URL: process.env.NEXT_PUBLIC_PUBLIC_URL,
6+
// NEXT_PUBLIC_CMS_URL: process.env.NEXT_PUBLIC_CMS_URL,
7+
// NEXT_PUBLIC_GTAG_ID: process.env.NEXT_PUBLIC_GTAG_ID,
8+
NEXT_PUBLIC_API_URL: process.env.NEXT_PUBLIC_API_URL,
99
},
1010
// @see https://github.com/zeit/next.js/wiki/Deployment
1111
// When process.env.BUILD_ID is undefined, fall back to the default

0 commit comments

Comments
 (0)