1
0
mirror of https://github.com/elk-zone/elk synced 2024-11-24 07:06:08 +09:00

fix: nitro config

This commit is contained in:
Anthony Fu 2023-01-08 14:27:29 +01:00
parent b7b6f0d1ca
commit fd2c433644

View File

@ -1,4 +1,5 @@
import { createResolver, defineNuxtModule } from '@nuxt/kit'
import { isCI } from 'std-env'
import { getEnv, version } from '../config/env'
import type { BuildInfo } from '~/types'
@ -21,10 +22,12 @@ export default defineNuxtModule({
nuxt.options.runtimeConfig.public.env = env
nuxt.options.runtimeConfig.public.buildInfo = buildInfo
nuxt.options.nitro.publicAssets ||= nuxt.options.nitro.publicAssets || []
if (env === 'canary' || env === 'preview')
nuxt.options.nitro.publicAssets.push({ dir: resolve('../public-staging') })
else if (env === 'dev')
nuxt.options.nitro.publicAssets.push({ dir: resolve('../public-dev') })
nuxt.hook('nitro:config', (config) => {
config.publicAssets = config.publicAssets || []
if (env === 'dev')
config.publicAssets.push({ dir: resolve('../public-dev') })
else if (env === 'canary' || env === 'preview' || !isCI)
config.publicAssets.push({ dir: resolve('../public-staging') })
})
},
})