From e842c42321cc56d802f105813e554297d49e5217 Mon Sep 17 00:00:00 2001 From: Graeme Date: Thu, 10 May 2018 10:26:54 -0700 Subject: [PATCH 1/2] Update paths.js, rename shadow path variable This file requires the "path" module and sets it to a variable `path`. The function `ensureSlash` also has a variable `path` that then shadows the `path` module. --- packages/react-scripts/config/paths.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/react-scripts/config/paths.js b/packages/react-scripts/config/paths.js index d7f55b6f638..481144c1e84 100644 --- a/packages/react-scripts/config/paths.js +++ b/packages/react-scripts/config/paths.js @@ -20,14 +20,14 @@ const resolveApp = relativePath => path.resolve(appDirectory, relativePath); const envPublicUrl = process.env.PUBLIC_URL; -function ensureSlash(path, needsSlash) { - const hasSlash = path.endsWith('/'); +function ensureSlash(pathIn, needsSlash) { + const hasSlash = pathIn.endsWith('/'); if (hasSlash && !needsSlash) { - return path.substr(0, path.length - 1); + return pathIn.substr(0, pathIn.length - 1); } else if (!hasSlash && needsSlash) { - return `${path}/`; + return `${pathIn}/`; } else { - return path; + return pathIn; } } From 70e5a4d5ccaceba06d8a7ed30144e475dadd726e Mon Sep 17 00:00:00 2001 From: Graeme Date: Tue, 22 May 2018 17:29:05 -0700 Subject: [PATCH 2/2] Update paths.js --- packages/react-scripts/config/paths.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/react-scripts/config/paths.js b/packages/react-scripts/config/paths.js index 481144c1e84..32665e9b76c 100644 --- a/packages/react-scripts/config/paths.js +++ b/packages/react-scripts/config/paths.js @@ -20,14 +20,14 @@ const resolveApp = relativePath => path.resolve(appDirectory, relativePath); const envPublicUrl = process.env.PUBLIC_URL; -function ensureSlash(pathIn, needsSlash) { - const hasSlash = pathIn.endsWith('/'); +function ensureSlash(inputPath, needsSlash) { + const hasSlash = inputPath.endsWith('/'); if (hasSlash && !needsSlash) { - return pathIn.substr(0, pathIn.length - 1); + return inputPath.substr(0, inputPath.length - 1); } else if (!hasSlash && needsSlash) { - return `${pathIn}/`; + return `${inputPath}/`; } else { - return pathIn; + return inputPath; } }