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