From 572e68a2c5123f4820dadcab8dc1c6336ea7d01b Mon Sep 17 00:00:00 2001 From: Blaine Kasten Date: Thu, 9 Jul 2020 09:03:57 -0500 Subject: [PATCH] wrap in production checks --- packages/gatsby-link/src/index.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/gatsby-link/src/index.js b/packages/gatsby-link/src/index.js index db66837631dd7..7206979c63e8d 100644 --- a/packages/gatsby-link/src/index.js +++ b/packages/gatsby-link/src/index.js @@ -27,9 +27,17 @@ export function withPrefix(path, prefix = getGlobalBasePrefix()) { // These global values are wrapped in typeof clauses to ensure the values exist. // This is especially problematic in unit testing of this component. const getGlobalPathPrefix = () => - typeof __PATH_PREFIX__ !== `undefined` ? __PATH_PREFIX__ : undefined + process.env.NODE_ENV !== `production` + ? typeof __PATH_PREFIX__ !== `undefined` + ? __PATH_PREFIX__ + : undefined + : __PATH_PREFIX__ const getGlobalBasePrefix = () => - typeof __BASE_PATH__ !== `undefined` ? __BASE_PATH__ : undefined + process.env.NODE_ENV !== `production` + ? typeof __BASE_PATH__ !== `undefined` + ? __BASE_PATH__ + : undefined + : __BASE_PATH__ const isLocalLink = path => path &&