-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnuxt.config.ts
88 lines (83 loc) · 1.83 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
import process from 'process';
import { defineNuxtConfig } from 'nuxt/config';
import { locales } from './locales';
/**
* 域名切换国际化
*/
let browserLocale = {};
if (process.env.LOCALES_ENV === 'Browser') {
browserLocale = {
strategy: 'no_prefix',
detectBrowserLanguage: {
useCookie: true,
cookieKey: 'i18n_redirected',
redirectOn: 'root', // recommended
},
};
}
// https://v3.nuxtjs.org/api/configuration/nuxt.config
export default defineNuxtConfig({
devtools: {
enabled: true, // or false to disable
},
experimental: {
viewTransition: true,
},
// 更换源目录
srcDir: 'src',
modules: ['@nuxtjs/color-mode', '@nuxtjs/i18n', '@pinia/nuxt', '@vueuse/nuxt', '@nuxt/image'],
// 添加全局样式
css: ['@/assets/iconfont/iconfont.css', '@/assets/style/index.scss', '@/assets/style/tailwind.css'],
// nuxtImage
image: {
dir: 'assets/images',
},
// postcss
postcss: {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
},
// env配置
runtimeConfig: {
secret: process.env.SECRET,
public: {
localesEnv: process.env.LOCALES_ENV,
},
},
// TypeScript集成配置
typescript: {
// 扩展tsconfig配置
tsConfig: {
compilerOptions: {
strict: true,
types: ['@pinia/nuxt', '@nuxtjs/i18n'],
},
},
},
i18n: {
vueI18n: './i18n.config.ts', // if you are using custom path, default
differentDomains: false,
defaultLocale: 'zh-CN',
...browserLocale,
locales,
},
// 主题切换配置
colorMode: {
classSuffix: '',
fallback: 'light',
storageKey: 'color-mode',
},
// vite配置
vite: {
logLevel: 'info',
css: {
preprocessorOptions: {
scss: {
additionalData: '@import "./src/assets/style/def.scss";',
},
},
},
},
});