答案 0 :(得分:2)
对于生产版本,请运行以下命令:
node --max_old_space_size=4096 ./node_modules/@angular/cli/bin/ng build --prod
答案 1 :(得分:1)
要生成产品,请运行以下命令:
node --max_old_space_size = 4096 node_modules / @ angular / cli / bin / ng构建 -目标生产
有关更多优化标志的信息,请在命令下方:
它具有内置的缓存清除功能和其他功能:
node --max_old_space_size = 4096 node_modules / @ angular / cli / bin / ng构建 -目标生产--build-optimizer --vendor-chunk
答案 2 :(得分:1)
导航到AppData-> Roming-> npm
打开ng.cmd
文件并替换为以下代码:
@IF EXIST "%~dp0\node.exe" (
"%~dp0\node.exe" "--max_old_space_size=8192" "%~dp0\node_modules\@angular\cli\bin\ng" %*
) ELSE (
@SETLOCAL
@SET PATHEXT=%PATHEXT:;.JS;=;%
node "--max_old_space_size=8192" "%~dp0\node_modules\@angular\cli\bin\ng" %*
)
并保存。