From 5b352f352fff98164bac0c989c2d8bf0621a9493 Mon Sep 17 00:00:00 2001 From: "DESKTOP-RQ919RC\\Pc" <1300399510@qq.com> Date: Tue, 8 Jul 2025 12:30:49 +0800 Subject: [PATCH] =?UTF-8?q?refactor(nuxt.config):=20=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=A0=BC=E5=BC=8F=E5=B9=B6=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?vite=E6=9C=8D=E5=8A=A1=E5=99=A8=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 统一代码缩进和引号风格 - 添加vite服务器构建配置以优化模块处理 - 保持原有功能不变 --- nuxt.config.ts | 93 ++++++++++++++++++++++++++++---------------------- 1 file changed, 52 insertions(+), 41 deletions(-) diff --git a/nuxt.config.ts b/nuxt.config.ts index 2f3c24b..8c7c3b1 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -1,32 +1,43 @@ // https://nuxt.com/docs/api/configuration/nuxt-config export default defineNuxtConfig({ - ssr: true, - components: true, - buildModules: ['@nuxtjs/composition-api/module'], + vite: { + $server: { + build: { + rollupOptions: { + output: { + preserveModules: false, + }, + }, + }, + }, + }, + ssr: true, + components: true, + buildModules: ["@nuxtjs/composition-api/module"], - env: { - baseUrl: process.env.BASE_URL || "http://localhost:3000", - }, + env: { + baseUrl: process.env.BASE_URL || "http://localhost:3000", + }, - app: { - buildAssetsDir: "/static/", + app: { + buildAssetsDir: "/static/", - head: { - link: [ - { - rel: "stylesheet", - href: "//bbs.gter.net/data/cache/style_2_common.css?Z62", - }, - ], - script: [ - {src: "https://app.gter.net/bottom?tpl=header&menukey=ask"}, - {src: "https://app.gter.net/bottom?tpl=footer,popupnotification", body: true}, - { - src: "https://bbs.gter.net/static/js/common.js", - body: true - }, - { - innerHTML: ` + head: { + link: [ + { + rel: "stylesheet", + href: "//bbs.gter.net/data/cache/style_2_common.css?Z62", + }, + ], + script: [ + { src: "https://app.gter.net/bottom?tpl=header&menukey=ask" }, + { src: "https://app.gter.net/bottom?tpl=footer,popupnotification", body: true }, + { + src: "https://bbs.gter.net/static/js/common.js", + body: true, + }, + { + innerHTML: ` window.userInfoWin = {} STYLEID = "2"; STATICURL = "static/"; @@ -45,24 +56,24 @@ export default defineNuxtConfig({ REPORTURL = "aHR0cDovL2Jicy5ndGVyLm5ldC9mb3J1bS5waHA/dGlkPTI0MDYzNTYmZ290bz1sYXN0cG9zdA=="; SITEURL = "https://ask.gter.net/"; JSPATH = "static/js/";`, - type: "text/javascript", - }, - ], - }, - }, + type: "text/javascript", + }, + ], + }, + }, - head: { - meta: [{charset: "utf-8"}, {name: "viewport", content: "width=device-width, initial-scale=1"}, {"http-equiv": "Cache-Control", content: "no-cache, no-store, must-revalidate"}, {"http-equiv": "Pragma", content: "no-cache"}, {"http-equiv": "Expires", content: "0"}], - }, + head: { + meta: [{ charset: "utf-8" }, { name: "viewport", content: "width=device-width, initial-scale=1" }, { "http-equiv": "Cache-Control", content: "no-cache, no-store, must-revalidate" }, { "http-equiv": "Pragma", content: "no-cache" }, { "http-equiv": "Expires", content: "0" }], + }, - devtools: {enabled: true}, + devtools: { enabled: true }, - build: { - loaders: { - imgUrl: {limit: 10000}, - }, - }, + build: { + loaders: { + imgUrl: { limit: 10000 }, + }, + }, - modules: ['@element-plus/nuxt'], - compatibilityDate: "2025-03-21", -}) \ No newline at end of file + modules: ["@element-plus/nuxt"], + compatibilityDate: "2025-03-21", +});