43 lines
1.2 KiB
TypeScript
43 lines
1.2 KiB
TypeScript
import legacy from '@vitejs/plugin-legacy';
|
|
import vue from '@vitejs/plugin-vue';
|
|
import vueJsx from '@vitejs/plugin-vue-jsx';
|
|
import type { PluginOption } from 'vite';
|
|
import { compression } from 'vite-plugin-compression2';
|
|
import { cdn } from './cdn';
|
|
import { configCompressPlugin } from './compress.ts';
|
|
import { viteBuildInfo } from './info';
|
|
|
|
export function getPluginsList(VITE_CDN: boolean, VITE_COMPRESSION: any): PluginOption[] {
|
|
return [
|
|
vue(),
|
|
legacy({
|
|
targets: ['android 4', 'ios 8', 'chrome 30', 'ie 6'],
|
|
additionalLegacyPolyfills: ['regenerator-runtime/runtime'],
|
|
renderLegacyChunks: true,
|
|
polyfills: [
|
|
'es.symbol',
|
|
'es.array.filter',
|
|
'es.promise',
|
|
'es.promise.finally',
|
|
'es/map',
|
|
'es/set',
|
|
'es.array.for-each',
|
|
'es.object.define-properties',
|
|
'es.object.define-property',
|
|
'es.object.get-own-property-descriptor',
|
|
'es.object.get-own-property-descriptors',
|
|
'es.object.keys',
|
|
'es.object.to-string',
|
|
'web.dom-collections.for-each',
|
|
'esnext.global-this',
|
|
'esnext.string.match-all',
|
|
],
|
|
}),
|
|
vueJsx(),
|
|
compression(),
|
|
viteBuildInfo(),
|
|
VITE_CDN ? cdn : null,
|
|
configCompressPlugin(VITE_COMPRESSION),
|
|
];
|
|
}
|