2026-07-30 11:23:50 +08:00
|
|
|
|
export default defineNuxtConfig({
|
|
|
|
|
|
// SPA 模式渲染,预留 SSR/SSG 升级能力
|
|
|
|
|
|
ssr: false,
|
|
|
|
|
|
|
|
|
|
|
|
modules: ['@unocss/nuxt', '@nuxtjs/i18n', '@pinia/nuxt', '@vueuse/nuxt'],
|
|
|
|
|
|
|
2026-08-11 18:42:11 +08:00
|
|
|
|
css: [
|
|
|
|
|
|
// Web 字体(fontsource,font-display: swap;CJK 已按 unicode-range 拆分,浏览器按页面字形按需下载)
|
|
|
|
|
|
// 正文/UI:Inter(英)+ Noto Sans SC(中);品牌大标题:Space Grotesk(英)+ Noto Sans SC 700(中)
|
|
|
|
|
|
'@fontsource/inter/400.css',
|
|
|
|
|
|
'@fontsource/inter/500.css',
|
|
|
|
|
|
'@fontsource/inter/700.css',
|
|
|
|
|
|
'@fontsource/noto-sans-sc/400.css',
|
|
|
|
|
|
'@fontsource/noto-sans-sc/700.css',
|
|
|
|
|
|
'@fontsource/space-grotesk/700.css',
|
|
|
|
|
|
'~/assets/css/main.css',
|
|
|
|
|
|
],
|
2026-07-31 19:02:00 +08:00
|
|
|
|
|
2026-08-11 16:45:25 +08:00
|
|
|
|
// 生产构建(nuxt build/generate,NODE_ENV=production)走同源相对路径 /api,由 nginx 反代到 backend;
|
|
|
|
|
|
// 开发(pnpm dev)直连本地后端。显式传入的 NUXT_PUBLIC_* 环境变量仍可覆盖。
|
|
|
|
|
|
// 注:Nuxt 默认只加载 .env,不会自动读 .env.production,故用 NODE_ENV 区分环境。
|
2026-07-31 19:02:00 +08:00
|
|
|
|
runtimeConfig: {
|
|
|
|
|
|
public: {
|
2026-08-11 16:45:25 +08:00
|
|
|
|
apiBaseUrl: process.env.NODE_ENV === 'production' ? '/api' : 'http://localhost:8083/api',
|
2026-08-04 19:18:35 +08:00
|
|
|
|
// 素材静态服务地址(用于解析 /uploads/... 相对路径),为空时默认取 apiBaseUrl 的 origin
|
|
|
|
|
|
assetBaseUrl: ''
|
2026-07-31 19:02:00 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
|
2026-07-30 11:23:50 +08:00
|
|
|
|
// 国际化:中文默认无前缀,英文 /en 前缀
|
2026-07-31 19:02:00 +08:00
|
|
|
|
// v10:显式指定 locale 文件(相对于 i18n/ 目录的 langDir)
|
2026-07-30 11:23:50 +08:00
|
|
|
|
i18n: {
|
|
|
|
|
|
locales: [
|
2026-07-31 19:02:00 +08:00
|
|
|
|
{ code: 'zh', language: 'zh-CN', name: '中文', file: 'zh.json' },
|
|
|
|
|
|
{ code: 'en', language: 'en-US', name: 'English', file: 'en.json' }
|
2026-07-30 11:23:50 +08:00
|
|
|
|
],
|
2026-07-31 19:02:00 +08:00
|
|
|
|
langDir: 'locales',
|
2026-07-30 11:23:50 +08:00
|
|
|
|
defaultLocale: 'zh',
|
2026-08-11 16:45:25 +08:00
|
|
|
|
// 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'),
|
2026-07-30 11:23:50 +08:00
|
|
|
|
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'
|
|
|
|
|
|
});
|