From 0b48c6b655aa4a3fa42a2a653043ccb8bfd6362a Mon Sep 17 00:00:00 2001
From: JEECG <445654970@qq.com>
Date: Tue, 27 May 2025 17:30:26 +0800
Subject: [PATCH] =?UTF-8?q?=E3=80=90issues/87=E3=80=91h5=E6=89=93=E5=8C=85?=
=?UTF-8?q?=E9=83=A8=E7=BD=B2=E5=90=8E,Oauth2=E8=AE=A4=E8=AF=81=E5=90=8E?=
=?UTF-8?q?=E6=97=A0=E6=B3=95=E6=AD=A3=E7=A1=AE=E5=BC=95=E5=85=A5app.confi?=
=?UTF-8?q?g.js=E6=96=87=E4=BB=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
vite.config.ts | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/vite.config.ts b/vite.config.ts
index 69995e9..ac9e91f 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -211,7 +211,16 @@ function createEnvConfigPlugin() {
const indexPath = path.join(outputDir, 'index.html')
if (fs.existsSync(indexPath)) {
let html = fs.readFileSync(indexPath, 'utf-8')
- const scriptTag = ''
+ // update-begin-author:liaozhiyang date:2025-05-27 for:【issues/87】h5打包部署后,Oauth2认证后无法正确引入app.config.js文件
+ let prefix = '/'
+ if (env.VITE_APP_PUBLIC_BASE) {
+ prefix = env.VITE_APP_PUBLIC_BASE
+ }
+ if (prefix.endsWith('/')) {
+ prefix = prefix.slice(0, -1)
+ }
+ const scriptTag = ``
+ // update-end-author:liaozhiyang date:2025-05-27 for:【issues/87】h5打包部署后,Oauth2认证后无法正确引入app.config.js文件
if (!html.includes('app.config.js')) {
html = html.replace('', ` \n ${scriptTag}`)
fs.writeFileSync(indexPath, html, 'utf-8')