index.js 864 B

1234567891011121314151617181920212223
  1. import vue from '@vitejs/plugin-vue'
  2. import createAutoImport from './auto-import'
  3. import createElementAutoImport from "./element-auto-import";
  4. import createSvgIcon from './svg-icon'
  5. import createCompression from './compression'
  6. import createSetupExtend from './setup-extend'
  7. import OptimizationPersist from 'vite-plugin-optimize-persist'
  8. import PkgConfig from 'vite-plugin-package-config'
  9. export default function createVitePlugins(viteEnv, isBuild = false) {
  10. const vitePlugins = [vue()]
  11. if(isBuild) {
  12. vitePlugins.push(PkgConfig())
  13. vitePlugins.push(OptimizationPersist())
  14. }
  15. vitePlugins.push(createAutoImport())
  16. vitePlugins.push(createElementAutoImport())
  17. vitePlugins.push(createSetupExtend())
  18. vitePlugins.push(createSvgIcon(isBuild))
  19. isBuild && vitePlugins.push(...createCompression(viteEnv))
  20. return vitePlugins
  21. }