-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnuxt.config.ts
More file actions
83 lines (79 loc) · 2.31 KB
/
nuxt.config.ts
File metadata and controls
83 lines (79 loc) · 2.31 KB
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
import fs from 'node:fs'
const portFromConfig = (() => {
try {
const raw = fs.readFileSync(new URL('./config.json', import.meta.url), 'utf-8')
const data = JSON.parse(raw)
const port = Number(data?.port)
if (!Number.isInteger(port)) return null
if (port < 1 || port > 65535) return null
return port
} catch {
return null
}
})()
if (portFromConfig && !process.env.NUXT_PORT && !process.env.PORT) {
process.env.NUXT_PORT = String(portFromConfig)
process.env.PORT = String(portFromConfig)
}
export default defineNuxtConfig({
compatibilityDate: '2025-07-15',
ssr: true,
devtools: { enabled: process.env.NODE_ENV !== 'production' },
modules: ['@vueuse/motion/nuxt'],
css: ['~/assets/css/tailwind.css'],
build: {
transpile: [
'naive-ui',
'vueuc',
'@css-render/vue3-ssr',
'@juggle/resize-observer'
]
},
vite: {
optimizeDeps: {
include: [
'naive-ui',
'vueuc',
'date-fns-tz/formatInTimeZone'
]
}
},
postcss: {
plugins: {
'@tailwindcss/postcss': {},
autoprefixer: {}
},
},
runtimeConfig: {
public: {
apiBase: '/api',
uploadPath: '/api/images/upload',
listPath: '/api/images/list'
}
},
nitro: {
routeRules: {
'/login': { headers: { 'Cache-Control': 'no-store' } },
'/dashboard': { headers: { 'Cache-Control': 'no-store' } },
'/images/**': { headers: { 'Cache-Control': 'no-store' } },
'/config': { headers: { 'Cache-Control': 'no-store' } },
'/users': { headers: { 'Cache-Control': 'no-store' } },
'/api/**': { headers: { 'Cache-Control': 'no-store' } },
'/': { headers: { 'Cache-Control': 'no-store' } },
'/uploads/**': {
headers: {
'X-Content-Type-Options': 'nosniff',
'Content-Security-Policy': "sandbox; default-src 'none'; base-uri 'none'; form-action 'none'; frame-ancestors 'none'",
'Cache-Control': 'no-store'
}
},
'/_nuxt/**': { headers: { 'Cache-Control': 'public, max-age=31536000, immutable' } },
'/assets/**': { headers: { 'Cache-Control': 'public, max-age=31536000, immutable' } },
'/favicon.ico': { headers: { 'Cache-Control': 'public, max-age=31536000, immutable' } },
}
},
typescript: {
strict: true,
typeCheck: false
}
})