28 lines
1.1 KiB
TypeScript
28 lines
1.1 KiB
TypeScript
import vue from '@vitejs/plugin-vue';
|
|
|
|
import createAutoImport from './auto-import';
|
|
import createComponents from "./components";
|
|
import createSvgIcon from './svg-icon';
|
|
import createCompression from './compression';
|
|
import createSetupExtend from './setup-extend';
|
|
import { PluginOption } from 'vite';
|
|
import { webUpdateNotice } from '@plugin-web-update-notification/vite'
|
|
|
|
export default function createVitePlugins(viteEnv: Record<string, string>, isBuild = false) {
|
|
const vitePlugins: PluginOption[] = [vue(), webUpdateNotice({
|
|
versionType: 'build_timestamp',//'git_commit_hash' | 'pkg_version' | 'build_timestamp' | 'custom'
|
|
notificationProps: {
|
|
title: '系统升级通知',
|
|
description: '检测到当前系统版本已更新,请刷新页面后使用。',
|
|
buttonText: '刷新',
|
|
dismissButtonText: '忽略'
|
|
}
|
|
})];
|
|
vitePlugins.push(createAutoImport());
|
|
vitePlugins.push(createComponents());
|
|
vitePlugins.push(createSetupExtend());
|
|
vitePlugins.push(createSvgIcon(isBuild));
|
|
isBuild && vitePlugins.push(...createCompression(viteEnv));
|
|
return vitePlugins;
|
|
}
|