mirror of
https://gitee.com/log4j/pig-ui.git
synced 2024-12-22 21:22:33 +08:00
✨ Introducing new features. 打包开启gzip
This commit is contained in:
parent
df6389ecaa
commit
60d376bc9a
@ -51,7 +51,9 @@
|
||||
"typescript": "^4.9.4",
|
||||
"unplugin-auto-import": "^0.13.0",
|
||||
"vite": "^4.0.0",
|
||||
"vite-plugin-compression": "^0.5.1",
|
||||
"vite-plugin-style-import": "^2.0.0",
|
||||
"vite-plugin-top-level-await": "^1.2.4",
|
||||
"vite-plugin-vue-setup-extend": "^0.4.0",
|
||||
"vue-eslint-parser": "^9.1.0"
|
||||
},
|
||||
|
@ -47,24 +47,9 @@ function mergeArrObj<T>(list: T, key: string) {
|
||||
}
|
||||
|
||||
|
||||
// 从后台获取数据
|
||||
info().then((res: any) => {
|
||||
itemize["zh-cn"].push(...res.data['zh-cn'])
|
||||
itemize.en.push(...res.data.en)
|
||||
}).finally(() => {
|
||||
// 处理最终格式
|
||||
for (const key in itemize) {
|
||||
messages[key] = {
|
||||
name: key,
|
||||
el: element[key].el,
|
||||
...mergeArrObj(itemize, key),
|
||||
};
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
// 远程获取i18n
|
||||
const infoI18n = await info()
|
||||
|
||||
itemize["zh-cn"].push(...infoI18n.data['zh-cn'])
|
||||
itemize.en.push(...infoI18n.data.en)
|
||||
|
||||
|
@ -4,9 +4,11 @@ import {defineConfig, loadEnv, ConfigEnv} from 'vite';
|
||||
import vueSetupExtend from 'vite-plugin-vue-setup-extend';
|
||||
// vue3 自动引入
|
||||
import AutoImport from 'unplugin-auto-import/vite'
|
||||
import topLevelAwait from 'vite-plugin-top-level-await'
|
||||
|
||||
// 按需加载
|
||||
import {createStyleImportPlugin, VxeTableResolve} from 'vite-plugin-style-import'
|
||||
import viteCompression from "vite-plugin-compression";
|
||||
|
||||
const pathResolve = (dir: string) => {
|
||||
return resolve(__dirname, '.', dir);
|
||||
@ -31,7 +33,15 @@ const viteConfig = defineConfig((mode: ConfigEnv) => {
|
||||
resolves: [
|
||||
VxeTableResolve()
|
||||
],
|
||||
})],
|
||||
}), topLevelAwait({
|
||||
// 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}`
|
||||
}), viteCompression({
|
||||
deleteOriginFile: true
|
||||
})
|
||||
],
|
||||
root: process.cwd(),
|
||||
resolve: {alias},
|
||||
base: mode.command === 'serve' ? './' : env.VITE_PUBLIC_PATH,
|
||||
|
Loading…
Reference in New Issue
Block a user