From 3bb13c780f610f2f33764347d410f9ed930f6ddb Mon Sep 17 00:00:00 2001 From: karl-police Date: Thu, 29 Aug 2024 20:30:07 +0200 Subject: [PATCH] Dynamic URL based on Dev Environment --- next.config.js | 5 ++++- src/js/modules/page_config.js | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/next.config.js b/next.config.js index 1840edf..e417da8 100644 --- a/next.config.js +++ b/next.config.js @@ -1,3 +1,6 @@ +var b_isDevelopment = (process.env.NODE_ENV == "development") + + /** @type {import('next').NextConfig} */ const nextConfig = { // enables static exports @@ -15,7 +18,7 @@ const nextConfig = { * * @see https://nextjs.org/docs/app/api-reference/next-config-js/basePath */ - basePath: "/binary-pattern-painter-online", + basePath: (!b_isDevelopment) ? "/binary-pattern-painter-online" : "", distDir: 'build', diff --git a/src/js/modules/page_config.js b/src/js/modules/page_config.js index 9703456..26fc99a 100644 --- a/src/js/modules/page_config.js +++ b/src/js/modules/page_config.js @@ -1,9 +1,11 @@ +var b_isDevelopment = (process.env.NODE_ENV == "development") + const PAGE_CONFIG = { /** * @type string */ - home_url: "https://karl-police.github.io/binary-pattern-painter-online", + home_url: (!b_isDevelopment) ? "https://karl-police.github.io/binary-pattern-painter-online" : "../", }