mirror of
https://gitee.com/newgateway/vtj.git
synced 2026-05-07 19:59:38 +08:00
33 lines
798 B
TypeScript
33 lines
798 B
TypeScript
import { createViteConfig } from '@vtj/cli';
|
|
import { library } from './vtj.config';
|
|
|
|
const isUmd = !!process.env.UMD;
|
|
|
|
const globals = {
|
|
vue: 'Vue',
|
|
'vue-router': 'VueRouter',
|
|
'element-plus': 'ElementPlus',
|
|
'@vueuse/core': 'VueUse',
|
|
'@vtj/utils': 'VtjUtils',
|
|
'@vtj/icons': 'VtjIcons',
|
|
'@vtj/ui': 'VtjUI',
|
|
echarts: 'echarts'
|
|
};
|
|
|
|
function createOptions(umd: boolean, externalGlobals: Record<string, string>) {
|
|
return {
|
|
lib: true,
|
|
dts: !umd,
|
|
emptyOutDir: !umd,
|
|
library,
|
|
libFileName: 'index',
|
|
entry: 'src/library/index.ts',
|
|
formats: umd ? ['umd'] : ['es'],
|
|
buildTarget: 'es2015',
|
|
external: Object.keys(externalGlobals),
|
|
externalGlobals: umd ? externalGlobals : undefined
|
|
};
|
|
}
|
|
|
|
export default createViteConfig(createOptions(isUmd, globals));
|