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",
|
"typescript": "^4.9.4",
|
||||||
"unplugin-auto-import": "^0.13.0",
|
"unplugin-auto-import": "^0.13.0",
|
||||||
"vite": "^4.0.0",
|
"vite": "^4.0.0",
|
||||||
|
"vite-plugin-compression": "^0.5.1",
|
||||||
"vite-plugin-style-import": "^2.0.0",
|
"vite-plugin-style-import": "^2.0.0",
|
||||||
|
"vite-plugin-top-level-await": "^1.2.4",
|
||||||
"vite-plugin-vue-setup-extend": "^0.4.0",
|
"vite-plugin-vue-setup-extend": "^0.4.0",
|
||||||
"vue-eslint-parser": "^9.1.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
|
// 远程获取i18n
|
||||||
const infoI18n = await info()
|
const infoI18n = await info()
|
||||||
|
|
||||||
itemize["zh-cn"].push(...infoI18n.data['zh-cn'])
|
itemize["zh-cn"].push(...infoI18n.data['zh-cn'])
|
||||||
itemize.en.push(...infoI18n.data.en)
|
itemize.en.push(...infoI18n.data.en)
|
||||||
|
|
||||||
|
@ -4,9 +4,11 @@ import {defineConfig, loadEnv, ConfigEnv} from 'vite';
|
|||||||
import vueSetupExtend from 'vite-plugin-vue-setup-extend';
|
import vueSetupExtend from 'vite-plugin-vue-setup-extend';
|
||||||
// vue3 自动引入
|
// vue3 自动引入
|
||||||
import AutoImport from 'unplugin-auto-import/vite'
|
import AutoImport from 'unplugin-auto-import/vite'
|
||||||
|
import topLevelAwait from 'vite-plugin-top-level-await'
|
||||||
|
|
||||||
// 按需加载
|
// 按需加载
|
||||||
import {createStyleImportPlugin, VxeTableResolve} from 'vite-plugin-style-import'
|
import {createStyleImportPlugin, VxeTableResolve} from 'vite-plugin-style-import'
|
||||||
|
import viteCompression from "vite-plugin-compression";
|
||||||
|
|
||||||
const pathResolve = (dir: string) => {
|
const pathResolve = (dir: string) => {
|
||||||
return resolve(__dirname, '.', dir);
|
return resolve(__dirname, '.', dir);
|
||||||
@ -31,7 +33,15 @@ const viteConfig = defineConfig((mode: ConfigEnv) => {
|
|||||||
resolves: [
|
resolves: [
|
||||||
VxeTableResolve()
|
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(),
|
root: process.cwd(),
|
||||||
resolve: {alias},
|
resolve: {alias},
|
||||||
base: mode.command === 'serve' ? './' : env.VITE_PUBLIC_PATH,
|
base: mode.command === 'serve' ? './' : env.VITE_PUBLIC_PATH,
|
||||||
|
Loading…
Reference in New Issue
Block a user