vue打包时vendor过大
下面是打包时各文件的大小:
static/js/14.371cbf04659d9943189f.js 3.58 kB 14 [emitted]
static/img/iconfont.ea9cb15.svg 17.4 kB [emitted]
static/img/banner1.eb751d0.jpg 106 kB [emitted]
static/img/banner3.ccd6568.jpg 90.4 kB [emitted]
static/js/0.a885c8bab8101de05613.js 37.8 kB 0 [emitted] vendor-async
static/js/1.3eba1c56fb0885633718.js 179 kB 1 [emitted]
static/js/2.df01b9129a08f1466c1d.js 137 kB 2 [emitted]
static/js/3.61908b40cbb127fb5722.js 3.42 kB 3 [emitted]
static/js/4.668291d80619ab39e645.js 4.28 kB 4 [emitted]
static/js/5.18636bef710d30e1b6d4.js 3.76 kB 5 [emitted]
static/js/6.c918ad6ce12487048780.js 1.53 kB 6 [emitted]
static/js/7.596003ff272ae3a7a387.js 2.06 kB 7 [emitted]
static/js/8.07fe5ae5045d5ecf9e05.js 1.6 kB 8 [emitted]
static/js/9.54f259bba675fc85aff8.js 2.85 kB 9 [emitted]
static/js/10.ee0ce388cb79ad705bcf.js 2 kB 10 [emitted]
static/js/11.a20cc55ce642a3162e45.js 2.68 kB 11 [emitted]
static/js/12.493b4305039c3d2d0e2d.js 2.04 kB 12 [emitted]
static/js/13.d727df6981c3ac2e1d15.js 2.92 kB 13 [emitted]
static/img/banner2.c702936.jpg 61.4 kB [emitted]
static/js/15.112cc3046b15101b070c.js 1.99 kB 15 [emitted]
static/js/16.10edf640132e32d16a13.js 1.1 kB 16 [emitted]
static/js/17.8d6313f6caec8fc6a380.js 2.97 kB 17 [emitted]
static/js/18.20bdd7c178e1d8358be1.js 1.05 kB 18 [emitted]
static/js/19.df1288245658e279b99d.js 1.99 kB 19 [emitted]
static/js/20.78e1ce4673cf199f972c.js 9.7 kB 20 [emitted]
static/js/21.98643a26e7ca5267a1dc.js 275 bytes 21 [emitted]
static/js/22.d448b2ce29028b9fcfd2.js 277 bytes 22 [emitted]
static/js/23.72e7b2092a7f89888899.js 275 bytes 23 [emitted]
static/js/24.1bb6f9eb1b8ac6ce7427.js 277 bytes 24 [emitted]
static/js/25.48413507942d683ce9e6.js 275 bytes 25 [emitted]
static/js/26.6e59ef0d742ddeb1cd68.js 275 bytes 26 [emitted]
static/js/vendor.0fe45dea0eb21974faa7.js 257 kB 27 [emitted] [big] vendor
static/js/app.76c0384a69e7196d9a52.js 7.1 kB 28 [emitted] app
static/js/manifest.01a952faf71932878b13.js 2.08 kB 29 [emitted] manifest
static/css/app.eb0c1934da28428cbba0369410fb169c.css 122 kB 28 [emitted] app
index.html 536 bytes [emitted]
安装的依赖有
"dependencies": {
"axios": "^0.18.0",
"mint-ui": "^2.2.13",
"node-sass": "^4.9.4",
"vue": "^2.5.2",
"vue-awesome-swiper": "^3.1.3",
"vue-router": "^3.0.1",
"vuex": "^3.0.1"
},
该怎么优化?已经用了路由懒加载
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
1、使用的库按需加载 2、善用cdn缓存 3、图片压缩和放在cdn上面缓存
你看可以看看是不是是不是有图片被打包进js了, 一个图片可能就几十kb, 配置中有一个图片打包的最小大小
再把gzip开了 200kb 压缩一下可能就100kb不到了 还是可以接受的