45 lines
1.3 KiB
TypeScript
45 lines
1.3 KiB
TypeScript
|
import { cdn } from './cdn';
|
||
|
import vue from '@vitejs/plugin-vue';
|
||
|
import type { PluginOption } from 'vite';
|
||
|
import vueJsx from '@vitejs/plugin-vue-jsx';
|
||
|
import legacy from '@vitejs/plugin-legacy';
|
||
|
import { compression } from 'vite-plugin-compression2';
|
||
|
import { viteMockServe } from 'vite-plugin-mock';
|
||
|
import { viteBuildInfo } from './info';
|
||
|
import { configCompressPlugin } from './compress.ts';
|
||
|
|
||
|
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),
|
||
|
viteMockServe({ mockPath: 'src/api/mock' }),
|
||
|
];
|
||
|
}
|