1、刪除多余不需要的庫: npm uninstall xxx
如例如moment庫文件是很大的可以直接放到index.html文件直接CDN引入
2、修改/config/index.js配置文件:將productionGzip設(shè)置為false
?
3、設(shè)置vue-router懶加載
懶加載配置:
?
非懶加載配置:
?
4、在webpack.prod.conf.js文件中修改配置:
?
5、在index.html文件中使用CDN
?
6、修改/build/webpack.base.conf.js中修改配置。給module.exports添加externals屬性(詳細(xì):?https://webpack.docschina.org/configuration/externals/)
?
7、按需引入element-ui文章來源:http://www.zghlxwxcb.cn/news/detail-681043.html
?文章來源地址http://www.zghlxwxcb.cn/news/detail-681043.html
到了這里,關(guān)于Vue項目中app.js過大,導(dǎo)致web初始化加載過慢問題的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!