Open xmsz opened 3 years ago
如果还是包超大小,可以尝试使用试验性功能删除无用文件,f.yml中添加如下配置:
experimentalFeatures:
removeUselessFiles: true
https://www.yuque.com/midwayjs/midway_v2/deploy_aliyun_faq#sJA7S
删除package.json无效
如果还是包超大小,可以尝试使用试验性功能删除无用文件,f.yml中添加如下配置:
experimentalFeatures: removeUselessFiles: true
有效
- Experimental Feature RemoveUselessFiles
- Useless files Count 5422
- Remove Useless file 33.93 MB
这是为什么
不过现在也快50m了
The function app_index has been packaged. A total of 9235 files were compressed and the final size was 41.77 MB
可以到.serverless目录里面的node_modules按照大小排序看下是哪个包导致的:
du -hs * | sort -h
可以到.serverless目录里面的node_modules按照大小排序看下是哪个包导致的:
du -hs * | sort -h
3.8M @serverless-devs
4.1M es-abstract
4.1M eslint
4.5M jsdom
4.9M lodash
5.1M moment
5.8M node-notifier
6.2M @babel
6.4M @jest
6.5M protobufjs
7.0M figlet
7.4M core-js
7.8M @typescript-eslint
17M rxjs
19M inquirer
19M prettier
25M typeorm
53M detective-typescript
58M typescript
67M @midwayjs
86M @alicloud
然后我又检查了一遍依赖发现比原始项目多了
"@midwayjs/cli-plugin-faas": "^1.2.73",
"@midwayjs/fcli-plugin-fc": "^1.2.73",
而且是在dependencies的
然后我把这两个放在devDependencies里,就
3.7M @serverless-devs
3.9M jsdom
4.1M es-abstract
4.6M eslint
4.9M lodash
5.1M moment
5.8M node-notifier
6.2M @babel
6.5M protobufjs
7.0M figlet
7.1M @typescript-eslint
7.4M core-js
17M rxjs
19M prettier
26M typeorm
53M detective-typescript
58M typescript
71M @midwayjs
108M @alicloud
虽然@alicloud和@midwayjs还是很大,但是最终上传变成了11m
- Experimental Feature RemoveUselessFiles
- Useless files Count 4519
- Remove Useless file 21.65 MB
The function app_index has been packaged. A total of 7040 files were compressed and the final size was 11.65MB
是否考虑下增量打包呢?官方一个小demo 每次npm run deploy 都需要 1-3分钟
部署无法增量。。。
怎么会有 58M typescript
呢
package.json
执行
npm run deploy
报错
相关问题:https://github.com/midwayjs/midway/issues/764