feat: 小文件合并

This commit is contained in:
dataeaseShu 2024-09-03 10:25:33 +08:00
parent 456550a6bd
commit ba1908ad98
3 changed files with 5 additions and 2 deletions

View File

@ -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'
}
}
}

View File

@ -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 // 请求超时时间

View File

@ -2,6 +2,7 @@ export {}
declare global {
interface Window {
DataEaseBi: any
_de_get_time_out: number
}
interface Fn<T = any> {
(...arg: T[]): T