57 lines
1.9 KiB
TypeScript
57 lines
1.9 KiB
TypeScript
export default defineNuxtConfig({
|
||
// SPA 模式渲染,预留 SSR/SSG 升级能力
|
||
ssr: false,
|
||
|
||
modules: ['@unocss/nuxt', '@nuxtjs/i18n', '@pinia/nuxt', '@vueuse/nuxt'],
|
||
|
||
css: ['~/assets/css/main.css'],
|
||
|
||
// 生产构建(nuxt build/generate,NODE_ENV=production)走同源相对路径 /api,由 nginx 反代到 backend;
|
||
// 开发(pnpm dev)直连本地后端。显式传入的 NUXT_PUBLIC_* 环境变量仍可覆盖。
|
||
// 注:Nuxt 默认只加载 .env,不会自动读 .env.production,故用 NODE_ENV 区分环境。
|
||
runtimeConfig: {
|
||
public: {
|
||
apiBaseUrl: process.env.NODE_ENV === 'production' ? '/api' : 'http://localhost:8083/api',
|
||
// 素材静态服务地址(用于解析 /uploads/... 相对路径),为空时默认取 apiBaseUrl 的 origin
|
||
assetBaseUrl: ''
|
||
}
|
||
},
|
||
|
||
// 国际化:中文默认无前缀,英文 /en 前缀
|
||
// v10:显式指定 locale 文件(相对于 i18n/ 目录的 langDir)
|
||
i18n: {
|
||
locales: [
|
||
{ code: 'zh', language: 'zh-CN', name: '中文', file: 'zh.json' },
|
||
{ code: 'en', language: 'en-US', name: 'English', file: 'en.json' }
|
||
],
|
||
langDir: 'locales',
|
||
defaultLocale: 'zh',
|
||
// SEO 标签(canonical / hreflang)所需的站点基础 URL:显式 NUXT_PUBLIC_SITE_URL 优先,
|
||
// 否则生产默认正式域名、开发默认本地 dev 地址
|
||
baseUrl:
|
||
process.env.NUXT_PUBLIC_SITE_URL ||
|
||
(process.env.NODE_ENV === 'production' ? 'https://www.luxsin.com.cn' : 'http://localhost:3100'),
|
||
strategy: 'prefix_except_default',
|
||
detectBrowserLanguage: {
|
||
useCookie: true,
|
||
cookieKey: 'i18n_redirected',
|
||
redirectOn: 'root'
|
||
}
|
||
},
|
||
|
||
app: {
|
||
head: {
|
||
title: '乐笙 Luxsin',
|
||
meta: [{ name: 'description', content: '乐笙(Luxsin)产品官网' }]
|
||
}
|
||
},
|
||
|
||
devServer: {
|
||
port: 3100
|
||
},
|
||
|
||
telemetry: false,
|
||
|
||
compatibilityDate: '2026-07-29'
|
||
});
|