mirror of
https://github.com/xiangshu233/vue3-vant4-mobile.git
synced 2025-04-06 03:57:47 +08:00
build: 📦 chunk 打包优化
This commit is contained in:
parent
e62d5988e1
commit
302bc7d955
@ -100,14 +100,14 @@ export default ({ command, mode }: ConfigEnv): UserConfig => {
|
|||||||
chunkSizeWarningLimit: 2000,
|
chunkSizeWarningLimit: 2000,
|
||||||
// 自定义底层的 Rollup 打包配置
|
// 自定义底层的 Rollup 打包配置
|
||||||
rollupOptions: {
|
rollupOptions: {
|
||||||
// 静态资源分类打包
|
// 静态资源分类打包
|
||||||
output: {
|
output: {
|
||||||
chunkFileNames: 'js/[name]-[hash].js', // 引入文件名的名称
|
chunkFileNames: 'js/[name]-[hash].js', // 引入文件名的名称
|
||||||
entryFileNames: 'js/[name]-[hash].js', // 包的入口文件名称
|
entryFileNames: 'js/[name]-[hash].js', // 包的入口文件名称
|
||||||
assetFileNames: '[ext]/[name]-[hash].[ext]', // 资源文件像 字体,图片等
|
assetFileNames: '[ext]/[name]-[hash].[ext]', // 资源文件像 字体,图片等
|
||||||
// 将 node_modules 三方依赖包最小化拆分
|
// 将 node_modules 三方依赖包最小化拆分
|
||||||
manualChunks(id) {
|
manualChunks(id) {
|
||||||
if (id.includes('node_modules') && !id.includes('@antv')) {
|
if (id.includes('node_modules')) {
|
||||||
const paths = id.toString().split('node_modules/')
|
const paths = id.toString().split('node_modules/')
|
||||||
if (paths[2]) {
|
if (paths[2]) {
|
||||||
return paths[2].split('/')[0].toString()
|
return paths[2].split('/')[0].toString()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user