angular前端加载问题

1.增加分析报告

package.json增加如下配置

"build": "node --max-old-space-size=15000 \"node_modules/@angular/cli/bin/ng\" build --prod --aot   --vendor-chunk=false --build-optimizer --output-hashing=all --base-href /ceshi/  --source-map --stats-json ",
"bundle-report": "webpack-bundle-analyzer ceshi/stats-es2015.json"

先运行npm run build 再运行npm run bundle-report

2.服务端apache开启gzip

httpd.conf增加

LoadModule deflate_module modules/mod_deflate.so

<IfModule mod_deflate.c>

# 设置压缩类型

AddOutputFilterByType DEFLATE text/plain

AddOutputFilterByType DEFLATE text/html

AddOutputFilterByType DEFLATE text/xml

AddOutputFilterByType DEFLATE text/css

AddOutputFilterByType DEFLATE text/javascript

AddOutputFilterByType DEFLATE image/svg+xml

AddOutputFilterByType DEFLATE image/x-icon

AddOutputFilterByType DEFLATE application/xml

AddOutputFilterByType DEFLATE application/xhtml+xml

AddOutputFilterByType DEFLATE application/rss+xml

AddOutputFilterByType DEFLATE application/javascript

AddOutputFilterByType DEFLATE application/x-javascript

<IfModule mod_headers.c>

# 自定义Header

Header append Vary User-Agent

Header append Powerd-By XXXXX

</IfModule>

</IfModule>

 

posted @ 2022-05-12 19:51  chinadba  阅读(38)  评论(0编辑  收藏  举报