From 35c001ded649d9aa71504d1f59be4705c8556597 Mon Sep 17 00:00:00 2001 From: "James M. Greene" Date: Sun, 11 Sep 2022 09:56:25 -0500 Subject: [PATCH] Dereference as 'path' This minimizes the changes to the codebase, as well as slightly clarifying that its value may not remain the same as the 'pathname' --- src/set-pages-config.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/set-pages-config.js b/src/set-pages-config.js index c4b8fe2..b9f85f2 100644 --- a/src/set-pages-config.js +++ b/src/set-pages-config.js @@ -5,7 +5,7 @@ const removeTrailingSlash = require('./remove-trailing-slash') // Return the settings to be passed to a {ConfigParser} for a given static site generator, // optional configuration file path, and a Pages siteUrl value to inject function getConfigParserSettings({ staticSiteGenerator, generatorConfigFile, siteUrl }) { - let { pathname, origin } = siteUrl + let { pathname: path, origin } = siteUrl switch (staticSiteGenerator) { case 'nuxt': @@ -14,7 +14,7 @@ function getConfigParserSettings({ staticSiteGenerator, generatorConfigFile, sit blankConfigurationFile: `${__dirname}/blank-configurations/nuxt.js`, properties: { // Configure a base path on the router - 'router.base': pathname, + 'router.base': path, // Set the target to static too // https://nuxtjs.org/docs/configuration-glossary/configuration-target/ @@ -23,14 +23,14 @@ function getConfigParserSettings({ staticSiteGenerator, generatorConfigFile, sit } case 'next': // Next does not want a trailing slash - pathname = removeTrailingSlash(pathname) + path = removeTrailingSlash(path) return { configurationFile: generatorConfigFile || './next.config.js', blankConfigurationFile: `${__dirname}/blank-configurations/next.js`, properties: { // Configure a base path - basePath: pathname, + basePath: path, // Disable server side image optimization too // https://nextjs.org/docs/api-reference/next/image#unoptimized @@ -43,21 +43,21 @@ function getConfigParserSettings({ staticSiteGenerator, generatorConfigFile, sit blankConfigurationFile: `${__dirname}/blank-configurations/gatsby.js`, properties: { // Configure a path prefix - pathPrefix: pathname, + pathPrefix: path, // Configure a site url 'siteMetadata.siteUrl': origin } } case 'sveltekit': // SvelteKit does not want a trailing slash - pathname = removeTrailingSlash(pathname) + path = removeTrailingSlash(path) return { configurationFile: generatorConfigFile || './svelte.config.js', blankConfigurationFile: `${__dirname}/blank-configurations/sveltekit.js`, properties: { // Configure a base path - 'kit.paths.base': pathname, + 'kit.paths.base': path, // Configure a prerender origin 'kit.prerender.origin': origin }