-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathnuxt.config.ts
58 lines (56 loc) · 1.69 KB
/
nuxt.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// https://v3.nuxtjs.org/api/configuration/nuxt.config
import vueJsx from "@vitejs/plugin-vue-jsx";
import { resolve } from 'pathe'
import { loadEnv } from 'vite'
const envScript = process?.env?.npm_lifecycle_script?.split(' ')
const envName = envScript?.[envScript.length - 1] || "" // 通过启动命令区分环境
const envData = loadEnv(envName, 'env') as any
export default defineNuxtConfig({
runtimeConfig: {
public: {
baseUrl: envData // env下读取的数据
}
},
app: {
head: {
charset: 'utf-8',
viewport: 'width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no',
title: '小张很嚣张的博客',
meta: [
{ name: 'description', content: '小张很嚣张的博客.' },
{ name: 'referrer', content: 'no-referrer' },
{ name: 'baidu-site-verification', content: 'codeva-rgtlUyttyQ' },
],
script: [{ src: "https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-2563370598283962", async: 'true', crossorigin: 'anonymous' }],
link: [
{ rel: "icon", type: "image/x-icon", href: "/favicon.ico" }
]
}
},
build: {
transpile:
process.env.NODE_ENV === 'production'
? [
'naive-ui',
'vueuc',
'@css-render/vue3-ssr',
'@juggle/resize-observer'
]
: ['@juggle/resize-observer']
},
alias: {
'@': resolve(__dirname, '.'),
},
vite: {
envDir: '~/env',
optimizeDeps: {
include:
process.env.NODE_ENV === 'development'
? ['naive-ui', 'vueuc', 'date-fns-tz/esm/formatInTimeZone']
: []
},
plugins: [
vueJsx(),
],
},
})