110 lines
2.4 KiB
TypeScript
110 lines
2.4 KiB
TypeScript
import { pwa } from './app/config/pwa'
|
|
import { appDescription } from './app/constants/index'
|
|
|
|
export default defineNuxtConfig({
|
|
ssr: true,
|
|
modules: [
|
|
'@vueuse/nuxt',
|
|
'@unocss/nuxt',
|
|
'@pinia/nuxt',
|
|
'@nuxtjs/color-mode',
|
|
'@vite-pwa/nuxt',
|
|
'@nuxt/eslint',
|
|
],
|
|
routeRules: {
|
|
'/': { redirect: '/model-square' }
|
|
},
|
|
nitro: {
|
|
devProxy: {
|
|
'/api': {
|
|
target: 'http://example.com',
|
|
changeOrigin: true,
|
|
prependPath: true
|
|
}
|
|
}
|
|
},
|
|
devtools: {
|
|
enabled: true,
|
|
},
|
|
|
|
build: {
|
|
transpile:
|
|
process.env.NODE_ENV === 'production'
|
|
? ['naive-ui', 'vueuc', '@css-render/vue3-ssr', '@juggle/resize-observer']
|
|
: ['@juggle/resize-observer']
|
|
},
|
|
vite: {
|
|
define: {
|
|
'process.env.DEBUG': false,
|
|
},
|
|
// 避免 vite 热更新时出现警告
|
|
// optimizeDeps: {
|
|
// include: ['date-fns-tz/esm/formatInTimeZone']
|
|
// }
|
|
},
|
|
|
|
app: {
|
|
head: {
|
|
viewport: 'width=device-width,initial-scale=1',
|
|
link: [
|
|
{ rel: 'icon', href: '/favicon.ico', sizes: 'any' },
|
|
{ rel: 'icon', type: 'image/svg+xml', href: '/nuxt.svg' },
|
|
{ rel: 'apple-touch-icon', href: '/apple-touch-icon.png' },
|
|
],
|
|
meta: [
|
|
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
|
|
{ name: 'description', content: appDescription },
|
|
{ name: 'apple-mobile-web-app-status-bar-style', content: 'black-translucent' },
|
|
{ name: 'theme-color', media: '(prefers-color-scheme: light)', content: 'white' },
|
|
{ name: 'theme-color', media: '(prefers-color-scheme: dark)', content: '#222222' },
|
|
]
|
|
},
|
|
},
|
|
|
|
// css: [
|
|
// '@unocss/reset/tailwind.css',
|
|
// ],
|
|
|
|
colorMode: {
|
|
classSuffix: '',
|
|
},
|
|
|
|
future: {
|
|
compatibilityVersion: 4,
|
|
},
|
|
|
|
experimental: {
|
|
// when using generate, payload js assets included in sw precache manifest
|
|
// but missing on offline, disabling extraction it until fixed
|
|
payloadExtraction: false,
|
|
renderJsonPayloads: true,
|
|
typedPages: true,
|
|
},
|
|
|
|
compatibilityDate: '2024-08-14',
|
|
|
|
nitro: {
|
|
esbuild: {
|
|
options: {
|
|
target: 'esnext',
|
|
},
|
|
},
|
|
prerender: {
|
|
crawlLinks: false,
|
|
routes: ['/'],
|
|
ignore: ['/hi'],
|
|
},
|
|
},
|
|
|
|
eslint: {
|
|
config: {
|
|
standalone: false,
|
|
nuxt: {
|
|
sortConfigKeys: true,
|
|
},
|
|
},
|
|
},
|
|
|
|
pwa,
|
|
})
|