liveh5-nuxt/nuxt.config.js
xingyy a8e2faae0f refactor(layouts): 优化默认布局结构
- 移除 AppHeader 组件
- 调整页面主体的样式和布局refactor(components): 优化 XMessage 组件样式

- 调整样式属性顺序
- 优化模板结构

refactor(pages):重构首页布局

- 添加新的 LiveBroadcast 组件
- 实现拍品列表的瀑布流布局
- 优化拍品卡片样式

refactor(config): 更新项目配置

- 移除 pages:extend钩子
- 更新兼容性日期
2025-01-09 19:37:03 +08:00

155 lines
3.3 KiB
JavaScript

import process from 'node:process'
import { appDescription } from './app/constants/index'
import preload from './app/utils/preload'
import { currentLocales } from './i18n/i18n'
export default defineNuxtConfig({
//
// hooks: {
// 'pages:extend'(pages) {
// const indexPage = pages.findIndex(page => page.path === '/')
// if (indexPage !== -1) {
// pages.splice(indexPage, 1)
// }
// pages.push({
// name: 'home',
// path: '/',
// file: '~/pages/home/index.vue'
// })
// }
// },
modules: [
'@vant/nuxt',
'@unocss/nuxt',
'@nuxtjs/color-mode',
'@nuxt/eslint',
'@nuxtjs/i18n',
'@pinia/nuxt',
'pinia-plugin-persistedstate/nuxt',
],
runtimeConfig: {
public: {
apiBase: process.env.NUXT_PUBLIC_API_BASE,
},
},
css: [
'@unocss/reset/tailwind.css',
'./app/styles/vars.css',
'./app/styles/global.css',
'./app/styles/default-theme.css',
],
postcss: {
plugins: {
'autoprefixer': {},
// https://github.com/wswmsword/postcss-mobile-forever
'postcss-mobile-forever': {
appSelector: '#__nuxt',
viewportWidth: 375,
maxDisplayWidth: 600,
// devtools excluded
exclude: /@nuxt/,
border: true,
rootContainingBlockSelectorList: [
'van-tabbar',
'van-popup',
],
},
},
},
colorMode: {
classSuffix: '',
preference: 'system',
fallback: 'light',
storageKey: 'nuxt-color-mode',
},
i18n: {
locales: currentLocales,
lazy: true,
strategy: 'no_prefix',
detectBrowserLanguage: {
useCookie: true,
cookieKey: 'i18n_redirected',
redirectOn: 'root',
alwaysRedirect: true,
fallbackLocale: 'zh-CN'
},
langDir: 'locales',
defaultLocale: 'zh-CN',
vueI18n: './i18n/i18n.config.ts',
},
app: {
pageTransition: {
name: 'page',
mode: 'out-in',
},
head: {
viewport: 'width=device-width,initial-scale=1,viewport-fit=cover',
link: [
{ rel: 'icon', href: '/favicon.ico', sizes: 'any' },
],
meta: [
{ name: 'viewport', content: 'width=device-width, initial-scale=1, viewport-fit=cover' },
{ name: 'apple-mobile-web-app-status-bar-style', content: 'black-translucent' },
{ name: 'theme-color', media: '(prefers-color-scheme: light)', content: '#ffffff' },
{ name: 'theme-color', media: '(prefers-color-scheme: dark)', content: '#222222' },
],
script: [
{ innerHTML: preload(), type: 'text/javascript', tagPosition: 'head' },
],
},
},
vite: {
build: {
target: 'esnext',
},
optimizeDeps: {
include: [
'@intlify/core-base',
'@intlify/shared',
'is-https',
],
},
},
experimental: {
typedPages: true,
},
devtools: {
enabled: true,
},
typescript: {
shim: false,
},
features: {
// For UnoCSS
inlineStyles: false,
},
eslint: {
config: {
standalone: false,
},
},
future: {
compatibilityVersion: 4,
},
// 指定 Nuxt 应用程序的兼容性日期,确保应用程序在未来的 Nuxt 版本中保持稳定性
compatibilityDate: '2025-01-09',
devServer: {
host: '0.0.0.0',
port: 3000,
},
})