Import baseUrl from config

This commit is contained in:
rmt/src 2023-06-18 16:02:46 +01:00
parent 54af194d92
commit 73c867ebc8
No known key found for this signature in database
GPG key ID: 6DD597637A8B880A
3 changed files with 6 additions and 4 deletions

View file

@ -63,7 +63,8 @@ export const config = figue({
.loadEnv({
...import.meta.env,
// Because the string 'import.meta.env.PACKAGE_VERSION' is statically replaced during build time (see 'define' in vite.config.ts)
PACKAGE_VERSION: import.meta.env.PACKAGE_VERSION,
PACKAGE_VERSION: import.meta.env?.PACKAGE_VERSION,
BASE_URL: import.meta.env?.BASE_URL || process.env.BASE_URL,
})
.validate()
.getConfig();

View file

@ -1,6 +1,6 @@
{
"extends": "@vue/tsconfig/tsconfig.node.json",
"include": ["vite.config.*"],
"include": ["vite.config.*", "./src/config.*"],
"compilerOptions": {
"composite": true,
"types": ["node", "vitest"]

View file

@ -15,6 +15,7 @@ import { configDefaults } from 'vitest/config';
import Icons from 'unplugin-icons/vite';
import IconsResolver from 'unplugin-icons/resolver';
import VueI18n from '@intlify/unplugin-vue-i18n/vite';
import { config } from './src/config';
// https://vitejs.dev/config/
export default defineConfig({
@ -55,7 +56,7 @@ export default defineConfig({
description: 'Aggregated set of useful tools for developers.',
display: 'standalone',
lang: 'fr-FR',
start_url: `${process.env.BASE_URL}/?utm_source=pwa&utm_medium=pwa`,
start_url: `${config.app.baseUrl}/?utm_source=pwa&utm_medium=pwa`,
orientation: 'any',
theme_color: '#18a058',
background_color: '#f1f5f9',
@ -92,7 +93,7 @@ export default defineConfig({
}),
Unocss(),
],
base: process.env.BASE_URL,
base: config.app.baseUrl,
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)),