-
Notifications
You must be signed in to change notification settings - Fork 0
/
nuxt.config.ts
146 lines (129 loc) · 2.97 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
import fs from 'node:fs'
import path from 'node:path'
import svgLoader from 'vite-svg-loader'
function getIcons(dir: string, icons: string[] = []) {
const _path = path.resolve(__dirname, dir)
const files = fs.readdirSync(_path)
files.forEach(file => {
const filePath = path.join(dir, file)
const stat = fs.statSync(filePath)
if (stat.isDirectory()) {
getIcons(filePath, icons)
} else if (path.extname(file).toLowerCase() === '.svg') {
icons.push(filePath)
}
})
return icons.map(icon => path.relative(_path, icon).replace(/\.svg$/, ''))
}
// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
runtimeConfig: {
public: {
noindex: String(process.env.NOINDEX) === 'true',
},
},
app: {
head: {
charset: 'utf-8',
viewport:
'width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no',
link: [{ rel: 'shortcut icon', type: 'image/x-icon', href: '/favicon.ico' }],
script: [
{
// tagPosition: 'bodyClose',
// src: '',
},
],
},
},
features: {
inlineStyles: false,
},
css: ['@unocss/reset/tailwind-compat.css'],
// routeRules: {
// ...(process.env.API_BASE_URL
// ? {
// '/server/**': {
// proxy: process.env.API_BASE_URL.replace(/\/+$/, '') + '/**',
// },
// }
// : {}),
// },
nitro: {
compressPublicAssets: true,
},
vite: {
plugins: [svgLoader()],
resolve: {
alias: {
'ant-design-vue/dist': 'ant-design-vue/dist',
'ant-design-vue/es': 'ant-design-vue/es',
'ant-design-vue/lib': 'ant-design-vue/es',
'ant-design-vue': 'ant-design-vue/es',
},
},
},
modules: [
'@nuxtjs/eslint-module',
'@nuxtjs/i18n',
'@nuxtjs/tailwindcss',
'@ant-design-vue/nuxt',
'@pinia/nuxt',
'dayjs-nuxt',
'@nuxt/image',
'@vueuse/nuxt',
'@nuxtjs/google-fonts',
'@nuxt/icon',
],
i18n: {
vueI18n: './i18n.config.ts',
compilation: {
strictMessage: false,
},
baseUrl: process.env.WEB_BASE_URL,
strategy: 'prefix_and_default',
lazy: true,
langDir: 'locales',
defaultLocale: 'en',
locales: [
{
code: 'en',
iso: 'en',
file: 'en.json',
translate: 'English',
},
{
code: 'zh-CN',
iso: 'zh-CN',
file: 'zh-CN.json',
translate: '简体中文',
},
],
},
antd: {
extractStyle: true,
},
googleFonts: {
families: {
Poppins: [400, 500, 600, 700],
},
},
image: {
domains: ['xx'],
},
icon: {
class: '',
mode: 'svg',
customCollections: [
{
prefix: 'icon',
dir: './assets/icons',
},
],
aliases: getIcons('./assets/icons').reduce(
(obj, icon) => ({ ...obj, [icon]: `icon:${icon}` }),
{} as Record<string, string>
),
},
compatibilityDate: '2024-07-21',
})