1 Star 0 Fork 304

小白白/ivzone

forked from iteaj/ivzone 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
IvzVitePlugins.js 2.30 KB
一键复制 编辑 原始数据 按行查看 历史
fjcydl 提交于 2022-07-13 14:59 . 升级类库
export const vitePluginChunk = {
name: 'vite-plugin-chunk',
outputOptions: (options) => {
options.manualChunks = (id, {getModuleInfo, getModuleIds}) => {
// console.log(id)
if(id.includes('node_modules/ant-design-vue')) {
return 'antd.min.esm'
} else if(id.includes('@ant-design/icons-vue')
|| id.includes('@ant-design/icons-svg')) {
return 'antd.icons.esm'
} else if(id.includes('node_modules/moment')) {
return 'moment.min.esm'
} else if(id.includes('node_modules/@vue/')) {
return 'vue.runtime.esm'
} else if(id.includes('node_modules/vue-router/')) {
return 'vue-router.esm'
} else if(id.includes('node_modules/vuex/')) {
return 'vuex.esm'
} else if(id.includes('node_modules/axios'
|| id.includes('node_modules/qs'))) {
return 'axios.qs.esm'
} else if(id.includes('node_modules/mockjs')) {
return 'mockjs.esm'
} else if(id.includes('node_modules/tinymce')) {
if(id.includes("tinymce.js")) {
return 'tinymce.esm'
} else if(id.includes("themes")) {
return 'themes/index'
} else if(id.includes("plugins")) {
return 'plugins/index'
} else if(id.includes("icons")) {
return 'icons/index'
}
return null// 'tinymce.esm'
} else if(id.includes("echarts")) {
return "echarts.esm"
} else if(id.includes('node_modules')) {
return 'vendor' // 其他第三方库
}
}
options.assetFileNames = (chunk) => {
if(chunk.name.includes('antd.min.css')) {
return `lib/antd.min.css`
}
return 'assets/[name].[hash].[ext]';
}
options.chunkFileNames = (chunk) => {
if(chunk.name.includes('esm')) {
return 'lib/[name].js'
} else if(chunk.name.includes('tinymce')) {
return 'tinymce/[name].js'
}
return 'assets/[name].[hash].js';
}
return options;
},
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/abcdefghijklmno/ivzone.git
git@gitee.com:abcdefghijklmno/ivzone.git
abcdefghijklmno
ivzone
ivzone
master

搜索帮助