遇到的情况:在Mac电脑上运行Vue项目的开发环境,webpack-dev-server打包时报内存溢出,程序终止。
错误信息:Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
解决办法:node_modules/.bin目录下找到webpack-dev-server(不是webpack-dev-server.cmd),添加 --max_old_space_size=10240,就OK了。
代码:
else
node --max_old_space_size=10240 "$basedir/../webpack-dev-server/bin/webpack-dev-server.js" "$@"
ret=$?
更多参考:
网友评论