From ba1908ad98ee0f738720923f1c988abcd5ec3484 Mon Sep 17 00:00:00 2001 From: dataeaseShu Date: Tue, 3 Sep 2024 10:25:33 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=B0=8F=E6=96=87=E4=BB=B6=E5=90=88?= =?UTF-8?q?=E5=B9=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/core-frontend/config/distributed.ts | 5 +++-- core/core-frontend/src/config/axios/service.ts | 1 + core/core-frontend/types/global.d.ts | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/core/core-frontend/config/distributed.ts b/core/core-frontend/config/distributed.ts index 9db5d95f95..453ae3f25b 100644 --- a/core/core-frontend/config/distributed.ts +++ b/core/core-frontend/config/distributed.ts @@ -1,6 +1,5 @@ import pkg from '../package.json' import viteCompression from 'vite-plugin-compression' - export default { plugins: [ viteCompression({ @@ -20,9 +19,11 @@ export default { chunkFileNames: `assets/chunk/[name]-${pkg.version}-${pkg.name}.js`, assetFileNames: `assets/[ext]/[name]-${pkg.version}-${pkg.name}.[ext]`, entryFileNames: `js/[name]-${pkg.version}-${pkg.name}.js`, - manualChunks(id: string) { + manualChunks(id: string, { getModuleInfo }) { if (id.includes('node_modules')) { return id.toString().split('node_modules/')[1].split('/')[0].toString() + } else if (id.includes('.vue') && getModuleInfo(id).code.length < 10000) { + return 'vendor' } } } diff --git a/core/core-frontend/src/config/axios/service.ts b/core/core-frontend/src/config/axios/service.ts index 320c7b93bb..c2c75363f9 100644 --- a/core/core-frontend/src/config/axios/service.ts +++ b/core/core-frontend/src/config/axios/service.ts @@ -75,6 +75,7 @@ const getTimeOut = () => { // 创建axios实例 const time = getTimeOut() +window._de_get_time_out = time const service: AxiosInstanceWithLoading = axios.create({ baseURL: PATH_URL, // api 的 base_url timeout: time ? time * 1000 : config.request_timeout // 请求超时时间 diff --git a/core/core-frontend/types/global.d.ts b/core/core-frontend/types/global.d.ts index 9e8a2f4aa4..da38b197ea 100644 --- a/core/core-frontend/types/global.d.ts +++ b/core/core-frontend/types/global.d.ts @@ -2,6 +2,7 @@ export {} declare global { interface Window { DataEaseBi: any + _de_get_time_out: number } interface Fn { (...arg: T[]): T