feat(chore): arco全量加载

This commit is contained in:
baiqi 2023-08-07 18:07:57 +08:00 committed by fit2-zhao
parent 9ab2a11af9
commit 05ede65b23
3 changed files with 8 additions and 9 deletions

View File

@ -3,8 +3,8 @@ import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue'; import vue from '@vitejs/plugin-vue';
import vueJsx from '@vitejs/plugin-vue-jsx'; import vueJsx from '@vitejs/plugin-vue-jsx';
import svgLoader from 'vite-svg-loader'; import svgLoader from 'vite-svg-loader';
import configArcoStyleImportPlugin from './plugin/arcoStyleImport'; // import configArcoStyleImportPlugin from './plugin/arcoStyleImport';
import configArcoResolverPlugin from './plugin/arcoResolver'; // import configArcoResolverPlugin from './plugin/arcoResolver';
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons'; import { createSvgIconsPlugin } from 'vite-plugin-svg-icons';
import vueSetupExtend from 'vite-plugin-vue-setup-extend'; import vueSetupExtend from 'vite-plugin-vue-setup-extend';
@ -14,8 +14,8 @@ export default defineConfig({
vueJsx(), vueJsx(),
vueSetupExtend(), vueSetupExtend(),
svgLoader({ svgoConfig: {} }), svgLoader({ svgoConfig: {} }),
configArcoResolverPlugin(), // configArcoResolverPlugin(),
configArcoStyleImportPlugin(), // configArcoStyleImportPlugin(),
createSvgIconsPlugin({ createSvgIconsPlugin({
// 指定需要缓存的图标文件夹 // 指定需要缓存的图标文件夹
iconDirs: [resolve(process.cwd(), 'src/assets/svg'), resolve(process.cwd(), 'public/images')], // 与本地储存地址一致 iconDirs: [resolve(process.cwd(), 'src/assets/svg'), resolve(process.cwd(), 'public/images')], // 与本地储存地址一致

View File

@ -12,9 +12,9 @@ export default mergeConfig(
rollupOptions: { rollupOptions: {
output: { output: {
manualChunks: { manualChunks: {
vue: ['vue', 'vue-router', 'pinia', '@vueuse/core', 'vue-i18n'],
arco: ['@arco-design/web-vue'], arco: ['@arco-design/web-vue'],
chart: ['echarts', 'vue-echarts'], chart: ['echarts', 'vue-echarts'],
vue: ['vue', 'vue-router', 'pinia', '@vueuse/core', 'vue-i18n'],
}, },
}, },
}, },

View File

@ -1,4 +1,6 @@
import { createApp } from 'vue'; import { createApp } from 'vue';
import ArcoVue from '@arco-design/web-vue';
import '@arco-themes/vue-ms-theme-default/index.less';
import FormCreate from '@form-create/arco-design'; import FormCreate from '@form-create/arco-design';
import ArcoVueIcon from '@arco-design/web-vue/es/icon'; import ArcoVueIcon from '@arco-design/web-vue/es/icon';
import SvgIcon from '@/components/pure/svg-icon/index.vue'; import SvgIcon from '@/components/pure/svg-icon/index.vue';
@ -11,9 +13,6 @@ import './mock';
import App from './App.vue'; import App from './App.vue';
// eslint-disable-next-line import/no-unresolved // eslint-disable-next-line import/no-unresolved
import 'virtual:svg-icons-register'; import 'virtual:svg-icons-register';
// Styles are imported via arco-plugin. See config/plugin/arcoStyleImport.ts in the directory for details
// 样式通过 arco-plugin 插件导入。详见目录文件 config/plugin/arcoStyleImport.ts
// https://arco.design/docs/designlab/use-theme-package
import '@/assets/style/global.less'; import '@/assets/style/global.less';
async function bootstrap() { async function bootstrap() {
@ -22,7 +21,7 @@ async function bootstrap() {
app.use(store); app.use(store);
// 注册国际化,需要异步阻塞,确保语言包加载完毕 // 注册国际化,需要异步阻塞,确保语言包加载完毕
await setupI18n(app); await setupI18n(app);
app.use(ArcoVue);
app.use(ArcoVueIcon); app.use(ArcoVueIcon);
app.component('MsIcon', MSIcon); app.component('MsIcon', MSIcon);
app.component('SvgIcon', SvgIcon); app.component('SvgIcon', SvgIcon);