From 99ffd3050c2d5a08efc2cd9dd56eec77fa042083 Mon Sep 17 00:00:00 2001 From: mikiher Date: Sat, 12 Oct 2024 11:46:44 +0300 Subject: [PATCH] Cleanup: Define routerBasePath constant in nuxt.config.js --- client/nuxt.config.js | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/client/nuxt.config.js b/client/nuxt.config.js index 1954696e..2b48971f 100644 --- a/client/nuxt.config.js +++ b/client/nuxt.config.js @@ -1,19 +1,21 @@ const pkg = require('./package.json') +const routerBasePath = process.env.ROUTER_BASE_PATH || '' + module.exports = { // Disable server-side rendering: https://go.nuxtjs.dev/ssr-mode ssr: false, target: 'static', dev: process.env.NODE_ENV !== 'production', env: { - serverUrl: process.env.NODE_ENV === 'production' ? process.env.ROUTER_BASE_PATH || '' : 'http://localhost:3333', + serverUrl: process.env.NODE_ENV === 'production' ? routerBasePath : 'http://localhost:3333', chromecastReceiver: 'FD1F76C5' }, telemetry: false, publicRuntimeConfig: { version: pkg.version, - routerBasePath: process.env.ROUTER_BASE_PATH || '' + routerBasePath }, // Global page headers: https://go.nuxtjs.dev/config-head @@ -30,13 +32,13 @@ module.exports = { ], script: [], link: [ - { rel: 'icon', type: 'image/x-icon', href: (process.env.ROUTER_BASE_PATH || '') + '/favicon.ico' }, - { rel: 'apple-touch-icon', href: (process.env.ROUTER_BASE_PATH || '') + '/ios_icon.png' } + { rel: 'icon', type: 'image/x-icon', href: routerBasePath + '/favicon.ico' }, + { rel: 'apple-touch-icon', href: routerBasePath + '/ios_icon.png' } ] }, router: { - base: process.env.ROUTER_BASE_PATH || '' + base: routerBasePath }, // Global CSS: https://go.nuxtjs.dev/config-css @@ -72,7 +74,7 @@ module.exports = { ], proxy: { - [`${process.env.ROUTER_BASE_PATH || ''}/api/`]: { target: process.env.NODE_ENV !== 'production' ? 'http://localhost:3333' : '/' } + [`${routerBasePath}/api/`]: { target: process.env.NODE_ENV !== 'production' ? 'http://localhost:3333' : '/' } }, io: { @@ -87,7 +89,7 @@ module.exports = { // Axios module configuration: https://go.nuxtjs.dev/config-axios axios: { - baseURL: process.env.ROUTER_BASE_PATH || '' + baseURL: routerBasePath }, // nuxt/pwa https://pwa.nuxtjs.org @@ -107,11 +109,11 @@ module.exports = { background_color: '#232323', icons: [ { - src: (process.env.ROUTER_BASE_PATH || '') + '/icon.svg', + src: routerBasePath + '/icon.svg', sizes: 'any' }, { - src: (process.env.ROUTER_BASE_PATH || '') + '/icon192.png', + src: routerBasePath + '/icon192.png', type: 'image/png', sizes: 'any' }