Skip to content

Commit

Permalink
feat: add optimizeDeps config for Vite
Browse files Browse the repository at this point in the history
  • Loading branch information
CharleeWa committed May 23, 2024
1 parent 9adcc89 commit 41e1292
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
20 changes: 20 additions & 0 deletions build/vite/optimize.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const include = [
'axios',
'store',
'echarts',
'lodash-es',
'resize-detector',
'store/plugins/expire',
'@varlet/ui/es/paper/style/index.mjs',
'@varlet/ui/es/cell/style/index.mjs',
'@varlet/ui/es/switch/style/index.mjs',
'@varlet/ui/es/picker/style/index.mjs',
'@varlet/ui/es/counter/style/index.mjs',
'@varlet/ui/es/space/style/index.mjs',
]

const exclude = [
'@iconify-json/carbon',
]

export { include, exclude }
3 changes: 3 additions & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import type { ConfigEnv, UserConfig } from 'vite'
import viewport from 'postcss-mobile-forever'
import autoprefixer from 'autoprefixer'
import { createVitePlugins } from './build/vite'
import { exclude, include } from './build/vite/optimize'

export default ({ mode }: ConfigEnv): UserConfig => {
const root = process.cwd()
Expand Down Expand Up @@ -51,5 +52,7 @@ export default ({ mode }: ConfigEnv): UserConfig => {
cssCodeSplit: false,
chunkSizeWarningLimit: 2048,
},

optimizeDeps: { include, exclude },
}
}

0 comments on commit 41e1292

Please sign in to comment.