From f0d6032edf7f38ff3dcbd7eff499272beb19d3ac Mon Sep 17 00:00:00 2001 From: "Z.X.PING" Date: Fri, 7 Jun 2024 20:59:26 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=B8=B4=E6=97=B6=E8=A7=A3=E5=86=B3=20d?= =?UTF-8?q?cloudio=20=E5=AE=98=E6=96=B9=E7=9A=84=20@dcloudio/uni-mp-compil?= =?UTF-8?q?er=20=E5=87=BA=E7=8E=B0=E7=9A=84=E7=BC=96=E8=AF=91=20BUG=20(#10?= =?UTF-8?q?3)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vite.config.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/vite.config.ts b/vite.config.ts index 5f630b5..e6a07de 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -62,6 +62,18 @@ export default ({ command, mode }) => { UniManifest(), // UniXXX 需要在 Uni 之前引入 Uni(), + { + // 临时解决 dcloudio 官方的 @dcloudio/uni-mp-compiler 出现的编译 BUG + // 参考 github issue: https://github.com/dcloudio/uni-app/issues/4952 + // 自定义插件禁用 vite:vue 插件的 devToolsEnabled,强制编译 vue 模板时 inline 为 true + name: 'fix-vite-plugin-vue', + configResolved(config) { + const plugin = config.plugins.find((p) => p.name === 'vite:vue') + if (plugin && plugin.api && plugin.api.options) { + plugin.api.options.devToolsEnabled = false + } + }, + }, UnoCSS(), AutoImport({ imports: ['vue', 'uni-app'],