Angular 打包 js文件 过大
1、加了--prod参数后,angular-cli会把用不到的包都删掉
//package.json 中 "scripts": { ... "build": "ng build --prod" ... }
2、nginx开启gzip优化、在nginx中server或http内上,添加这段代码
gzip on; gzip_static on; gzip_comp_level 2; gzip_http_version 1.0; gzip_proxied any; gzip_min_length 1100; gzip_buffers 16 8k; gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png; # Disable for IE < 6 because there are some known problems gzip_disable "MSIE [1-6].(?!.*SV1)"; # Add a vary header for downstream proxies to avoid sending cached gzipped files to IE6 gzip_vary on;
nginx 报错:
C:\WebData\nginx-1.18.0>nginx.exe -t nginx: [warn] the "ssl" directive is deprecated, use the "listen ... ssl" directive instead in C:\WebData\nginx-1.18.0/conf/nginx.conf:138 nginx: [emerg] unknown directive "锘縮erver" in C:/WebData/nginx-1.18.0/conf/conf.d/familyxiaomobile.conf:1 nginx: configuration file C:\WebData\nginx-1.18.0/conf/nginx.conf test failed
原因是其中一个文件格式为utf-8 +BOM 的格式,另存为 utf-8 就对了
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· ollama系列01:轻松3步本地部署deepseek,普通电脑可用
· 25岁的心里话
· 按钮权限的设计及实现
2020-10-08 微信公共账号开发:48001 api unauthorized解决
2020-10-08 windows 如何查看端口占用情况
2017-10-08 VirtualBox虚拟机网络设置(四种方式)