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