| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- // https://nuxt.com/docs/api/configuration/nuxt-config
- /*
- * @Author: wjc
- * @Date: 2023-10-25 19:39:32
- * @LastEditors: LiZhiWei
- * @LastEditTime: 2026-01-21 11:17:45
- * @Description:
- */
- import { loadEnv } from 'vite'
- import { createResolver } from '@nuxt/kit'
- const { resolve } = createResolver(import.meta.url)
- import { fileURLToPath } from 'url'
- import { appDescription } from './app/constants/index'
- const envName = process.env.npm_lifecycle_script?.match(/--mode\s(.*)/)?.[1] ?? 'development'
- const envData = loadEnv(envName, process.cwd()) // 获取.env文件中的配置
- Object.assign(process.env, envData) // 将环境配置信息,添加到process.env
- export default defineNuxtConfig({
- compatibilityDate: '2026-01-09',
- routeRules: {},
- alias: {
- '@': fileURLToPath(new URL('./app', import.meta.url)),
- },
- modules: [
- '@vueuse/nuxt',
- '@unocss/nuxt',
- '@pinia/nuxt',
- '@element-plus/nuxt',
- // '@nuxtjs/color-mode',
- // '@nuxtjs/i18n',
- ],
- experimental: {
- // when using generate, payload js assets included in sw precache manifest
- // but missing on offline, disabling extraction it until fixed
- payloadExtraction: false,
- renderJsonPayloads: false,
- typedPages: false,
- },
- imports: {
- dirs: [resolve('./stores'), '~/stores', '~/components', '~/components/section'],
- },
- css: ['@unocss/reset/tailwind.css', '~/assets/scss/common.scss'],
- vite: {
- css: {
- preprocessorOptions: {
- scss: {
- additionalData: `@use "~/assets/scss/vars.scss";`,
- },
- },
- },
- },
- nitro: {
- devProxy: {
- '/yyds': {
- target: 'https://wisdomcity.eu.org:30032/yyds',
- changeOrigin: true,
- prependPath: true,
- secure: false,
- },
- },
- },
- build: {},
- runtimeConfig: {
- public: {
- apiBase: process.env.NUXT_PUBLIC_API_BASE,
- },
- },
- app: {
- head: {
- viewport: 'width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no',
- link: [
- { rel: 'icon', href: '/logo.png', sizes: 'any' },
- { rel: 'icon', href: '/logo.png' },
- { rel: 'apple-touch-icon', href: '/logo.png' },
- {
- rel: 'preload',
- href: '/fonts/D-DIN-PRO-600-SemiBold.woff2',
- as: 'font',
- type: 'font/woff2',
- crossorigin: 'anonymous',
- },
- ],
- 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' },
- ],
- },
- },
- features: {
- inlineStyles: false,
- },
- components: true,
- sourcemap: {
- client: true,
- server: false,
- },
- })
|