javascript - 如何编译具有严格内存限制的打字稿
问题描述
我正在尝试在业余爱好者 Heroku 实例上部署一个小型 Typescript 项目,但我的构建步骤失败了FATAL ERROR: Ineffective mark-compacts near heap
我可以使用哪些有用的内存优化(在代码和我的 tsconfig 中)来构建具有 512mb 内存的东西?
我的构建命令和tsconfig如下:
tsc && node --optimize_for_size --max_old_space_size=460 dist/main.js
{
"compilerOptions": {
"target": "ES2019",
"module": "CommonJS",
"strict": true,
"skipLibCheck": true,
"esModuleInterop": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"strictPropertyInitialization": false,
"removeComments": true,
"incremental": true,
"sourceMap": false,
"declaration": false,
"outDir": "./dist"
}
}
解决方案
推荐阅读
- rest - api平台:_invoke方法中$data的字段为null
- c# - 将用户电子邮件地址保存到 ini 文件
- reactjs - 无法查看子组件中的数据
- javascript - 如何在没有下一步按钮的情况下制作多表单?
- docker - 构建映像时 npm install 失败
- postgresql - Postgres的行构造函数中哪些字符被双引号括起来
- php - php7 在 windows utf-8 字符问题中弹出
- javascript - 从 JSON 数据中循环遍历第一个数组中的多个对象,使用 FUNCTION COMPONENT 在 React 中显示两个带有对象的数组
- python - 如何根据变量在列中出现的次数对变量进行分组?
- c# - 在 .NET Core 控制台应用程序中使用 appsettings.ENV.json