Angular如何减少捆绑软件供应商和主要js文件的大小

时间:2019-02-28 07:59:07

标签: angular angular6 lazy-loading

我安装了全局安装source-map-explorer需要减少分发包文件以优化分析

  • 要提高我已完成的初始加载页面的速度
  
      
  1. 具有预加载功能的延迟加载模块。
  2.   
  3. 为图片和JS文件配置的Gulp压缩。
  4.   

因此需要减少bundle JS文件,我在angular 6项目中没有看到webpack.conf reference link文件。

  

$ npm install -g source-map-explorer

package.json

  {
  "name": "cfch",
  "version": "0.0.0",
  "main": "gulpfile.js",
  "scripts": {
    "ng": "ng",
    "start": "gulp && ng serve  --proxy-config proxy.conf.json",
    "build": "ng build --prod --source-map gulp",
    "prebuild": "gulp"
  },
  "dependencies": {
    "@angular/animations": "^6.1.0",
    "@angular/cdk": "^6.1.0",
    "@angular/common": "^6.1.0",
    "@angular/compiler": "^6.1.0",
    "@angular/core": "^6.1.0",
    "gulp-htmlmin": "^5.0.1",
    "gulp-imagemin": "^5.0.3",
    "gulp-minify-css": "^1.2.4",
    "gulp-uglify": "^3.0.1",
    "ts-xlsx": "0.0.11",
    "webpack-sources": "^1.3.0",
  },
"devDependencies": {
    "source-map-explorer": "^1.7.0",
   }

Result

Note:vendor.js and main.js 2.4MB and 222KB

0 个答案:

没有答案