2025-01-08 05:26:12 +00:00
|
|
|
import process from 'node:process'
|
|
|
|
import preload from './app/utils/preload'
|
|
|
|
import { currentLocales } from './i18n/i18n'
|
|
|
|
export default defineNuxtConfig({
|
2025-01-09 11:57:50 +00:00
|
|
|
|
|
|
|
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'
|
|
|
|
})
|
|
|
|
}
|
|
|
|
},
|
2025-01-08 05:26:12 +00:00
|
|
|
modules: [
|
|
|
|
'@vant/nuxt',
|
|
|
|
'@unocss/nuxt',
|
|
|
|
'@nuxtjs/color-mode',
|
|
|
|
'@nuxtjs/i18n',
|
|
|
|
],
|
|
|
|
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,
|
2025-01-08 07:32:55 +00:00
|
|
|
cookieKey: 'i18n_redirected',
|
|
|
|
redirectOn: 'root',
|
|
|
|
alwaysRedirect: true,
|
|
|
|
fallbackLocale: 'zh-CN'
|
2025-01-08 05:26:12 +00:00
|
|
|
},
|
|
|
|
langDir: 'locales',
|
|
|
|
defaultLocale: 'zh-CN',
|
|
|
|
vueI18n: './i18n/i18n.config.ts',
|
|
|
|
},
|
|
|
|
|
|
|
|
app: {
|
2025-01-08 07:32:55 +00:00
|
|
|
pageTransition: {
|
|
|
|
name: 'page',
|
|
|
|
mode: 'out-in',
|
|
|
|
},
|
2025-01-08 05:26:12 +00:00
|
|
|
head: {
|
|
|
|
viewport: 'width=device-width,initial-scale=1,viewport-fit=cover',
|
|
|
|
link: [
|
|
|
|
{ rel: 'icon', href: '/favicon.ico', sizes: 'any' },
|
|
|
|
],
|
|
|
|
meta: [
|
2025-01-13 06:00:35 +00:00
|
|
|
{ name: 'viewport', content: 'width=device-width, initial-scale=1, viewport-fit=cover,user-scalable=no' },
|
|
|
|
{ name: 'apple-mobile-web-app-capable', content: 'yes' },
|
2025-01-08 05:26:12 +00:00
|
|
|
{ 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,
|
|
|
|
},
|
|
|
|
|
|
|
|
future: {
|
|
|
|
compatibilityVersion: 4,
|
|
|
|
},
|
2025-01-08 07:32:55 +00:00
|
|
|
// 指定 Nuxt 应用程序的兼容性日期,确保应用程序在未来的 Nuxt 版本中保持稳定性
|
2025-01-09 11:37:03 +00:00
|
|
|
compatibilityDate: '2025-01-09',
|
2025-01-08 07:32:55 +00:00
|
|
|
devServer: {
|
2025-01-13 05:55:32 +00:00
|
|
|
host: 'localhost', // Set the host to 'localhost'
|
|
|
|
port: 3000, // Set the port to 3000 or any other port you prefer
|
2025-01-08 07:32:55 +00:00
|
|
|
},
|
2025-01-09 11:37:03 +00:00
|
|
|
})
|