打包支持
This commit is contained in:
parent
63068db281
commit
3b0e3393d9
@ -11,10 +11,10 @@ import AutoImport from 'unplugin-auto-import/vite'
|
||||
import Components from 'unplugin-vue-components/vite'
|
||||
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
|
||||
import viteCompression from 'vite-plugin-compression'
|
||||
import topLevelAwait from 'vite-plugin-top-level-await'
|
||||
import VueI18nPlugin from '@intlify/unplugin-vue-i18n/vite'
|
||||
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons'
|
||||
import UnoCSS from 'unocss/vite'
|
||||
import topLevelAwait from 'vite-plugin-top-level-await'
|
||||
|
||||
export function createVitePlugins() {
|
||||
const root = process.cwd()
|
||||
@ -31,7 +31,6 @@ export function createVitePlugins() {
|
||||
progress(),
|
||||
PurgeIcons(),
|
||||
ElementPlus({}),
|
||||
topLevelAwait(),
|
||||
AutoImport({
|
||||
include: [
|
||||
/\.[tj]sx?$/, // .ts, .tsx, .js, .jsx
|
||||
@ -89,6 +88,13 @@ export function createVitePlugins() {
|
||||
ext: '.gz', // 生成的压缩包后缀
|
||||
deleteOriginFile: false //压缩后是否删除源文件
|
||||
}),
|
||||
ViteEjsPlugin()
|
||||
ViteEjsPlugin(),
|
||||
topLevelAwait({
|
||||
// https://juejin.cn/post/7152191742513512485
|
||||
// The export name of top-level await promise for each chunk module
|
||||
promiseExportName: '__tla',
|
||||
// The function to generate import names of top-level await promise in each chunk module
|
||||
promiseImportName: (i) => `__tla_${i}`
|
||||
})
|
||||
]
|
||||
}
|
||||
|
@ -4,12 +4,7 @@ import { TableColumn } from '@/types/table'
|
||||
import * as MailAccountApi from '@/api/system/mail/account'
|
||||
|
||||
// 邮箱账号的列表
|
||||
let accountList: any[] = []
|
||||
|
||||
// 初始化账号列表
|
||||
const initAccountList = async () => {
|
||||
accountList = await MailAccountApi.getSimpleMailAccountList()
|
||||
}
|
||||
const accountList = await MailAccountApi.getSimpleMailAccountList()
|
||||
|
||||
// 表单校验
|
||||
export const rules = reactive({
|
||||
@ -59,12 +54,7 @@ const crudSchemas = reactive<CrudSchema[]>([
|
||||
search: {
|
||||
show: true,
|
||||
component: 'Select',
|
||||
api: async () => {
|
||||
if (accountList.length === 0) {
|
||||
await initAccountList()
|
||||
}
|
||||
return accountList
|
||||
},
|
||||
api: () => accountList,
|
||||
componentProps: {
|
||||
optionsAlias: {
|
||||
labelField: 'mail',
|
||||
@ -74,12 +64,7 @@ const crudSchemas = reactive<CrudSchema[]>([
|
||||
},
|
||||
form: {
|
||||
component: 'Select',
|
||||
api: async () => {
|
||||
if (accountList.length === 0) {
|
||||
await initAccountList()
|
||||
}
|
||||
return accountList
|
||||
},
|
||||
api: () => accountList,
|
||||
componentProps: {
|
||||
optionsAlias: {
|
||||
labelField: 'mail',
|
||||
|
@ -65,16 +65,7 @@ export default ({ command, mode }: ConfigEnv): UserConfig => {
|
||||
minify: 'terser',
|
||||
outDir: env.VITE_OUT_DIR || 'dist',
|
||||
sourcemap: env.VITE_SOURCEMAP === 'true' ? 'inline' : false,
|
||||
chunkSizeWarningLimit: 1500,
|
||||
rollupOptions: {
|
||||
output: {
|
||||
manualChunks: {
|
||||
'element-plus': ['element-plus'],
|
||||
'vue-vendor': ['vue', 'vue-router', 'pinia'],
|
||||
'echarts': ['echarts', 'echarts-wordcloud']
|
||||
}
|
||||
}
|
||||
},
|
||||
// brotliSize: false,
|
||||
terserOptions: {
|
||||
compress: {
|
||||
drop_debugger: env.VITE_DROP_DEBUGGER === 'true',
|
||||
@ -82,18 +73,6 @@ export default ({ command, mode }: ConfigEnv): UserConfig => {
|
||||
}
|
||||
}
|
||||
},
|
||||
optimizeDeps: {
|
||||
include,
|
||||
exclude,
|
||||
esbuildOptions: {
|
||||
target: 'es2020'
|
||||
}
|
||||
},
|
||||
// 添加对 SDK 文件的特殊处理
|
||||
define: {
|
||||
'process.env': {},
|
||||
'global': 'window',
|
||||
'require': 'window.require'
|
||||
}
|
||||
optimizeDeps: { include, exclude }
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user