-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnuxt.config.ts
98 lines (87 loc) · 2.22 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
import { join } from 'path';
// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
srcDir: 'src',
devtools: { enabled: true },
/* 配置文件 */
modules: [
[
'@pinia/nuxt',
{
autoImports: [
// 自动引入 `defineStore()`
'defineStore',
// 自动引入 `defineStore()` 并重命名为 `definePiniaStore()`
['defineStore', 'definePiniaStore']
]
}
],
'@unocss/nuxt',
// '@nuxtjs/eslint-module', //谨慎开启,会报错很多地方,主要用来检查一些函数是否用值,或者console,建议开发完之后使用
'@nuxtjs/svg-sprite',
'@pinia-plugin-persistedstate/nuxt',
'@nuxt/image',
'nuxt-icon'
],
/* 配置跨域代理 */
nitro: {
devProxy: {
'/api': {
target: process.env.NUXT_PUBLIC_API_BASE, // 这里是接口地址
changeOrigin: true,
prependPath: true
// rewrite: (path) => path.replace(/^\/api/, "")
}
}
},
/* 打包之后的地址 */
routeRules: {
'/api/**': {
proxy: 'http://127.0.0.1:9090/**'
}
},
/* 设置seo */
app: {
head: {
title: '个人博客',
meta: [
/* seo搜索引擎关键词 */
/* { name:'keywords',content:'关键词....'} */
],
link: [{ rel: 'logo icon', href: '/favicon.ico' }] // 路径是public下的
}
/* 动画效果 */
// pageTransition: { name: 'layout', mode: 'in-out' }
},
/* css */
css: ['~/styles/reset.css', '~/styles/comment.css', '~/styles/main.scss'],
/* vue-tsc */
typescript: {
typeCheck: true,
shim: false
},
/* nuxt/image配置 */
image: {
dir: 'assets/images/'
},
/* svg配置 */
svgSprite: {
input: '~/src/assets/sprite/svg',
output: '~/src/assets/sprite/gen'
},
alias: {
'~/src/assets/sprite/gen': join(__dirname, 'src/assets/sprite/gen')
},
/* 开启指定的地址 */
devServer: {
port: 8000,
host: '0.0.0.0'
},
/* 打包去除console.log等,开发者可以尽情写console.log */
vite: {
esbuild: {
drop: ['debugger'],
pure: ['console.log', 'console.error', 'console.warn', 'console.debug', 'console.trace']
}
}
});