forked from Mirrors/elk
fix: nitro config
This commit is contained in:
parent
b7b6f0d1ca
commit
fd2c433644
1 changed files with 8 additions and 5 deletions
|
@ -1,4 +1,5 @@
|
||||||
import { createResolver, defineNuxtModule } from '@nuxt/kit'
|
import { createResolver, defineNuxtModule } from '@nuxt/kit'
|
||||||
|
import { isCI } from 'std-env'
|
||||||
import { getEnv, version } from '../config/env'
|
import { getEnv, version } from '../config/env'
|
||||||
import type { BuildInfo } from '~/types'
|
import type { BuildInfo } from '~/types'
|
||||||
|
|
||||||
|
@ -21,10 +22,12 @@ export default defineNuxtModule({
|
||||||
nuxt.options.runtimeConfig.public.env = env
|
nuxt.options.runtimeConfig.public.env = env
|
||||||
nuxt.options.runtimeConfig.public.buildInfo = buildInfo
|
nuxt.options.runtimeConfig.public.buildInfo = buildInfo
|
||||||
|
|
||||||
nuxt.options.nitro.publicAssets ||= nuxt.options.nitro.publicAssets || []
|
nuxt.hook('nitro:config', (config) => {
|
||||||
if (env === 'canary' || env === 'preview')
|
config.publicAssets = config.publicAssets || []
|
||||||
nuxt.options.nitro.publicAssets.push({ dir: resolve('../public-staging') })
|
if (env === 'dev')
|
||||||
else if (env === 'dev')
|
config.publicAssets.push({ dir: resolve('../public-dev') })
|
||||||
nuxt.options.nitro.publicAssets.push({ dir: resolve('../public-dev') })
|
else if (env === 'canary' || env === 'preview' || !isCI)
|
||||||
|
config.publicAssets.push({ dir: resolve('../public-staging') })
|
||||||
|
})
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue