Increase JavaScript Heap size in create-react-app

2019-05-14 02:27发布

Node features the way to increase the heap size via passing in the --max-old-space-size command line flag. In create-react-app projects everything depends on the use of react-scripts. How can I pass in this parameter in such projects and where should I best do that?

Thank you for help.

2条回答
forever°为你锁心
2楼-- · 2019-05-14 02:51
"build": "react-scripts --max_old_space_size=4096 build"

This should work

查看更多
Deceive 欺骗
3楼-- · 2019-05-14 03:08

Thanks a lot to @dan-abramov as his comment is the answer! (Give him the vote up in case you come across this).

You can just put e.g. node --max_old_space_size=4096 node_modules/.bin/react-scripts start in there instead of react-scripts start

查看更多
登录 后发表回答