欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

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