-
Notifications
You must be signed in to change notification settings - Fork 1
/
nuxt.config.ts
159 lines (148 loc) · 3.33 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
147
148
149
150
151
152
153
154
155
156
157
158
159
// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
ssr: false,
devtools: { enabled: true },
modules: [
'@pinia/nuxt',
'@pinia-plugin-persistedstate/nuxt',
'shadcn-nuxt',
'@nuxtjs/tailwindcss',
'@nuxt/content',
'@vueuse/nuxt',
'nuxt-lucide-icons',
'@nuxt/image',
'@nuxtjs/color-mode',
'@nuxtjs/google-fonts',
'nuxt-vitalizer',
],
vite: {
build: {
target: 'es2022',
rollupOptions: {
output: {
manualChunks(id) {
const chunks = ['shiki', '@xterm'];
if (id.includes('/node_modules/')) {
for (const chunkName of chunks) {
if (id.includes(chunkName)) {
return chunkName;
}
}
}
},
},
},
},
worker: {
format: 'es',
},
resolve: {
dedupe: ['monaco-editor', 'vscode'],
},
plugins: [
// Allow SharedArrayBuffer use in development
{
name: 'configure-response-headers',
configureServer: (server) => {
server.middlewares.use((_req, res, next) => {
res.setHeader('Cross-Origin-Embedder-Policy', 'require-corp');
res.setHeader('Cross-Origin-Opener-Policy', 'same-origin');
next();
});
},
},
],
},
nitro: {
esbuild: {
options: {
target: 'esnext',
},
},
typescript: {
tsConfig: {
compilerOptions: {
experimentalDecorators: true,
},
},
},
// compressPublicAssets: true,
preset: 'bun',
},
routeRules: {
// Allow SharedArrayBuffer use in production
'/**': {
headers: {
'Cross-Origin-Embedder-Policy': 'require-corp',
'Cross-Origin-Opener-Policy': 'same-origin',
},
},
'/api/**': {
// allow full access to the API
headers: {
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, OPTIONS',
'Access-Control-Allow-Headers':
'X-Requested-With, Content-Type, Accept',
'Access-Control-Max-Age': '86400',
},
},
// Cache language servers
'/language-servers/**': {
headers: {
'Cache-Control': `max-age=${14 * 24 * 60 * 60 * 1000}, public`,
},
},
},
shadcn: {
/**
* Prefix for all the imported component
*/
prefix: '',
/**
* Directory that the component lives in.
* @default "./components/ui"
*/
componentDir: './components/ui',
},
content: {
highlight: {
theme: {
// Default theme (same as single string)
default: 'github-light-default',
dark: 'github-dark',
},
langs: ['cpp', 'java', 'python'],
},
},
colorMode: {
classSuffix: '',
},
googleFonts: {
families: {
Inter: {
wght: '300..850',
ital: '300..850',
},
'JetBrains+Mono': '200..800',
},
display: 'swap',
},
vitalizer: {
delayHydration: {
// Load heavy components only when the page content has been loaded
hydrateOnEvents: ['DOMContentLoaded'],
},
},
compatibilityDate: '2024-07-04',
app: {
head: {
link: [
{
rel: 'icon',
href: '/favicon.png',
},
],
},
},
});