angular8 本地打包 node内存溢出导致打包失败
项目体积增大到时候,在使用build出现内存溢出导致build失败;
在网上看到的解决方法是 进入node_modules里在bin/ng 目录文件下 首行增加
--max_old_space_size=4096
但是这个方法适合个人而不适合多人协作;因为node_modules可以移除,然后又要重新配置;(虽然我这个组就我一个前端!!)
可以在package.json 的 scripts 中配置;
"build": "ng build", "build-aot": "node --max_old_space_size=4096 ./node_modules/@angular/cli/bin/ng build --prod --aot --build-optimizer", "build-aot-max": "ng build --prod --aot",
这样就可以适用于多人协作了
想买的东西很贵,想去的地方很远,喜欢的女孩很完美