csi-financial-front/src/utils/build.ts

126 lines
3.0 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import importToCDN from 'vite-plugin-cdn-import';
/**
* 打包相关
* 注意 prodUrl使用的是 jsdelivr 还是 unpkg。它们的 path 可能不一致
* 文章链接https://blog.csdn.net/qq_34450741/article/details/129766676使用的是 jsdelivr
* @description importToCDN https://github.com/mmf-fe/vite-plugin-cdn-import
* @description cdn 在线引入的 cdn 地址配置。pathhttps://www.jsdelivr.com/ || https://unpkg.com/
* @description external 打包时过滤包导入。参考https://rollupjs.org/configuration-options/#external
*/
export const buildConfig = {
cdn() {
return importToCDN({
prodUrl: 'https://unpkg.com/{name}@{version}/{path}',
modules: [
// autoComplete('vue'),
// autoComplete('axios'),
{
name: 'vue',
var: 'Vue',
path: 'dist/vue.global.js',
},
{
name: 'vue-demi',
var: 'VueDemi',
path: 'lib/index.iife.js',
},
{
name: 'vue-router',
var: 'VueRouter',
path: 'dist/vue-router.global.js',
},
{
name: 'element-plus',
var: 'ElementPlus',
path: 'dist/index.full.js',
},
// {
// name: '@element-plus/icons-vue',
// var: 'ElementPlusIconsVue',
// path: 'dist/index.iife.min.js',
// },
// {
// name: 'echarts',
// var: 'echarts',
// path: 'dist/echarts.min.js',
// },
// {
// name: 'echarts-gl',
// var: 'echarts-gl',
// path: 'dist/echarts-gl.min.js',
// },
// {
// name: 'echarts-wordcloud',
// var: 'echarts-wordcloud',
// path: 'dist/echarts-wordcloud.min.js',
// },
// {
// name: 'vue-i18n',
// var: 'VueI18n',
// path: 'dist/vue-i18n.global.min.js',
// },
// {
// name: 'jsplumb',
// var: 'jsPlumb',
// path: 'dist/js/jsplumb.min.js',
// },
// {
// name: 'cropperjs',
// var: 'Cropper',
// path: 'dist/cropper.min.js',
// },
// {
// name: 'sortablejs',
// var: 'Sortable',
// path: 'Sortable.min.js',
// },
// {
// name: 'qrcodejs2-fixes',
// var: 'QRCode',
// path: 'qrcode.min.js',
// },
// {
// name: 'print-js',
// var: 'printJS',
// path: 'dist/print.min.js',
// },
// {
// name: '@wangeditor/editor',
// var: 'wangEditor',
// path: 'dist/index.min.js',
// },
// {
// name: '@wangeditor/editor-for-vue',
// var: 'WangEditorForVue',
// path: 'dist/index.min.js',
// },
// {
// name: 'vue-grid-layout',
// var: 'VueGridLayout',
// path: 'https://cdn.jsdelivr.net/npm/vue-grid-layout@3.0.0-beta1/dist/vue-grid-layout.umd.min.js',
// },
],
});
},
external: [
'vue',
// 'axios',
'vue-router',
'element-plus',
// '@element-plus/icons-vue',
// 'echarts',
// 'echarts-gl',
// 'echarts-wordcloud',
// 'vue-i18n',
// 'jsplumb',
// 'cropperjs',
// 'sortablejs',
// 'qrcodejs2-fixes',
// 'print-js',
// '@wangeditor/editor',
// '@wangeditor/editor-for-vue',
// 'vue-grid-layout',
],
};