From 5ebe1bb41638565947537edbd2fedefcc1424332 Mon Sep 17 00:00:00 2001 From: FamousMai <906631095@qq.com> Date: Tue, 29 Apr 2025 10:44:06 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20admin-web=E6=96=B0=E5=A2=9Ejs=E5=AF=BC?= =?UTF-8?q?=E5=85=A5=E7=9A=84=E8=B5=84=E6=BA=90=E8=B7=AF=E5=BE=84=E7=8E=AF?= =?UTF-8?q?=E5=A2=83=E5=8F=98=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- admin/web/.env.development | 3 +++ admin/web/.env.production | 3 +++ admin/web/vite.config.js | 7 ++++++- docker/docker-compose.dify-plus.yaml | 2 ++ 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/admin/web/.env.development b/admin/web/.env.development index aa7c7c2cb..cc5fd85ff 100644 --- a/admin/web/.env.development +++ b/admin/web/.env.development @@ -13,3 +13,6 @@ VITE_EDITOR = vscode VITE_OA_LOGIN_CLINET_ID = # oa地址 VITE_OA_URL = + +# 编译后js导入的资源路径 +JS_PATH = \ No newline at end of file diff --git a/admin/web/.env.production b/admin/web/.env.production index 86beeaa38..c8af70cbb 100644 --- a/admin/web/.env.production +++ b/admin/web/.env.production @@ -5,3 +5,6 @@ VITE_BASE_API = /api VITE_FILE_API = /api #下方修改为你的线上ip(如果需要在线使用表单构建工具时使用,其余情况无需使用以下环境变量) VITE_BASE_PATH = + +# 编译后js导入的资源路径 +JS_PATH = \ No newline at end of file diff --git a/admin/web/vite.config.js b/admin/web/vite.config.js index eddbad3d0..952fa1a09 100644 --- a/admin/web/vite.config.js +++ b/admin/web/vite.config.js @@ -46,9 +46,14 @@ export default ({ assetFileNames: 'admin/assets/[name].[hash].[ext]', }, } + + let base = '/' + if (process.env.JS_PATH) { + base = process.env.JS_PATH + '/' + } const config = { - base: '/', // 编译后js导入的资源路径 + base: base, // 编译后js导入的资源路径 root: './', // index.html文件所在位置 publicDir: 'public', // 静态资源文件夹 resolve: { diff --git a/docker/docker-compose.dify-plus.yaml b/docker/docker-compose.dify-plus.yaml index c02868c1c..f51ef2870 100644 --- a/docker/docker-compose.dify-plus.yaml +++ b/docker/docker-compose.dify-plus.yaml @@ -1109,6 +1109,8 @@ services: depends_on: - admin-server command: [ 'nginx-debug', '-g', 'daemon off;' ] + environment: + JS_PATH: ${JS_PATH:} networks: - default