vue优化之加快首屏加载速度
程序员文章站
2022-03-29 20:19:16
一、依赖优化之 CDN 加速减少app.js和vender.js的体积,加快加载速度二、gzip暴力压缩1.npm安装npm i compression-webpack-plugin@1.1.12 --save-dev2.配置,config里的index.js文件 build: { // Gzip off by default as many popular static hosts such as // Surge or Netlify already gzip all sta...
一、依赖优化之 CDN 加速
减少app.js和vender.js的体积,加快加载速度
二、gzip暴力压缩
1.npm安装npm i compression-webpack-plugin@1.1.12 --save-dev
2.配置,config里的index.js文件
build: {
// Gzip off by default as many popular static hosts such as
// Surge or Netlify already gzip all static assets for you.
// Before setting to `true`, make sure to:
// npm install --save-dev compression-webpack-plugin
productionGzip: true, //设置为true,之前时false 改为true
productionGzipExtensions: ['js', 'css'],
}
三、路由懒加载
{
path: '/list',
name: 'list',
component:resolve => require(["@/components/list"],resolve)
},
本文地址:https://blog.csdn.net/danruWang/article/details/107359245
上一篇: vue 父子组件间的传值(一)——父传子
下一篇: Swift脚本使用方式