代码注释
parent
e23d82dedb
commit
088a86835c
|
@ -17,6 +17,7 @@ import { configVisualizerConfig } from './visualizer';
|
||||||
import { configThemePlugin } from './theme';
|
import { configThemePlugin } from './theme';
|
||||||
import { configImageminPlugin } from './imagemin';
|
import { configImageminPlugin } from './imagemin';
|
||||||
import { configSvgIconsPlugin } from './svgSprite';
|
import { configSvgIconsPlugin } from './svgSprite';
|
||||||
|
//预编译插件vite3不好使了
|
||||||
import OptimizationPersist from 'vite-plugin-optimize-persist'
|
import OptimizationPersist from 'vite-plugin-optimize-persist'
|
||||||
import PkgConfig from 'vite-plugin-package-config'
|
import PkgConfig from 'vite-plugin-package-config'
|
||||||
|
|
||||||
|
@ -65,17 +66,17 @@ export function createVitePlugins(viteEnv: ViteEnv, isBuild: boolean) {
|
||||||
|
|
||||||
// The following plugins only work in the production environment
|
// The following plugins only work in the production environment
|
||||||
if (isBuild) {
|
if (isBuild) {
|
||||||
// vite-plugin-imagemin
|
// 图片资源压缩插件 vite-plugin-imagemin
|
||||||
VITE_USE_IMAGEMIN && vitePlugins.push(configImageminPlugin());
|
VITE_USE_IMAGEMIN && vitePlugins.push(configImageminPlugin());
|
||||||
|
|
||||||
// rollup-plugin-gzip
|
// 文件gzip压缩 rollup-plugin-gzip
|
||||||
vitePlugins.push(configCompressPlugin(VITE_BUILD_COMPRESS, VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE));
|
vitePlugins.push(configCompressPlugin(VITE_BUILD_COMPRESS, VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE));
|
||||||
|
|
||||||
// vite-plugin-pwa
|
// vite-plugin-pwa
|
||||||
vitePlugins.push(configPwaConfig(viteEnv));
|
vitePlugins.push(configPwaConfig(viteEnv));
|
||||||
}
|
}
|
||||||
|
|
||||||
//vite-plugin-theme【解决vite首次打开界面加载慢问题】
|
//预编译插件【解决vite首屏加载慢问题】vite-plugin-theme —— vite3不好使了
|
||||||
vitePlugins.push(PkgConfig());
|
vitePlugins.push(PkgConfig());
|
||||||
vitePlugins.push(OptimizationPersist());
|
vitePlugins.push(OptimizationPersist());
|
||||||
return vitePlugins;
|
return vitePlugins;
|
||||||
|
|
Loading…
Reference in New Issue