refactor: env config (#769)

This commit is contained in:
三咲智子 Kevin Deng 2023-01-04 21:26:30 +08:00 committed by GitHub
parent 9d5dc1bc3d
commit f892722220
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 121 additions and 64 deletions

View file

@ -3,9 +3,9 @@ import Inspect from 'vite-plugin-inspect'
import { isCI, isDevelopment } from 'std-env'
import { i18n } from './config/i18n'
import { pwa } from './config/pwa'
import { isPreview } from './config/env'
const { resolve } = createResolver(import.meta.url)
const isPreview = process.env.PULL_REQUEST === 'true' || process.env.CONTEXT === 'deploy-preview' || process.env.CONTEXT === 'dev'
export default defineNuxtConfig({
typescript: {
@ -90,7 +90,7 @@ export default defineNuxtConfig({
inviteToken: '',
},
public: {
env: isCI ? isPreview ? 'staging' : 'production' : 'local',
env: '', // set in build-info module
pwaEnabled: !isDevelopment || process.env.VITE_DEV_PWA === 'true',
translateApi: '',
},