chore: 编译依赖拆包manualChunks行为

This commit is contained in:
TsMask
2024-12-16 10:25:19 +08:00
parent a94f9414a4
commit 71f2e596fe
2 changed files with 16 additions and 9 deletions

View File

@@ -43,7 +43,6 @@ onMounted(() => {
getConfigKey('sys.homePage').then(res => { getConfigKey('sys.homePage').then(res => {
spinning.value = false; spinning.value = false;
if (res.code === RESULT_CODE_SUCCESS && res.data) { if (res.code === RESULT_CODE_SUCCESS && res.data) {
console.log(spinning);
if (res.data) { if (res.data) {
const asyncComponent = findView(`${res.data}`); const asyncComponent = findView(`${res.data}`);
currentComponent.value = defineAsyncComponent(asyncComponent); currentComponent.value = defineAsyncComponent(asyncComponent);

View File

@@ -54,14 +54,22 @@ export default defineConfig(({ mode }) => {
chunkFileNames: 'js/[name].[hash].js', chunkFileNames: 'js/[name].[hash].js',
// 用于输出静态资源的块 // 用于输出静态资源的块
assetFileNames: 'assets/[name].[hash].[ext]', assetFileNames: 'assets/[name].[hash].[ext]',
manualChunks: id => { manualChunks: {
if (id.includes('node_modules')) { vendorVue: ['vue', 'vue-router', 'pinia'],
return id vendorVuePlugins: ['vue-i18n', 'vue3-smooth-dnd', 'grid-layout-plus', '@vueuse/core'],
.toString() vendorAnt: ['ant-design-vue', '@ant-design/icons-vue'],
.split('node_modules/')[1] vendorAntv: ['@antv/g6'],
.split('/')[0] vendorEcharts: ['echarts'],
.toString(); vendorPDF: ['@tato30/vue-pdf'],
} vendorXterm: ['@xterm/xterm', '@xterm/addon-fit'],
vendorCodemirror: [
'codemirror',
'@codemirror/lang-yaml',
'@codemirror/lang-javascript',
'@codemirror/merge',
'@codemirror/theme-one-dark',
],
vendorUtils: ['crypto-js', 'nprogress', 'p-queue', 'dayjs', 'xlsx'],
}, },
}, },
}, },