Import publicRuntimeConfig from helper

This commit is contained in:
Sam Carlton 2022-05-01 11:38:40 -05:00
parent f6a1dacd54
commit 8ec2e77c06
2 changed files with 14 additions and 6 deletions

View file

@ -5,6 +5,7 @@ import tailwind from '@astrojs/tailwind'
// https://github.com/withastro/astro/tree/main/packages/integrations/netlify
import netlify from '@astrojs/netlify/functions'
import { makeViteDefinitions } from './helpers/public-runtime-config.mjs'
// https://astro.build/config
export default defineConfig({
@ -19,5 +20,15 @@ export default defineConfig({
// https://github.com/withastro/astro/tree/main/packages/integrations/vue
vue(),
tailwind()
]
],
// Vite options
// https://docs.astro.build/en/reference/configuration-reference/#vite
vite: {
// Vite: https://vitejs.dev/config/#define
// esbuild: https://esbuild.github.io/api/#define
define: {
...makeViteDefinitions()
}
}
});

View file

@ -2,6 +2,7 @@ import { promises as fs } from 'fs'
import pkg from './package.json'
import { getSiteUrl } from '~/helpers/get-site-url.js'
import { publicRuntimeConfig } from '~/helpers/public-runtime-config.mjs'
const siteUrl = getSiteUrl()
@ -10,11 +11,7 @@ const siteUrl = getSiteUrl()
export default {
target: 'static',
publicRuntimeConfig: {
allUpdateSubscribe: process.env.ALL_UPDATE_SUBSCRIBE,
testResultStore: process.env.TEST_RESULT_STORE,
siteUrl: process.env.URL
},
publicRuntimeConfig,
/*
** Hooks