在 NPX 中使用 max-old-space-size

问题描述 投票:0回答:1

我正在更新 package.json 中的脚本,该脚本使用“./node_modules”来使用 NPX 命令,并遇到了带有“max-old-space-size”参数的 ng build。我已将命令转换为以下

node --max-old-space-size=10240 ./node_modules/@angular/cli/bin/ng build --prod

npx --max-old-space-size=10240 ng build --prod

我有两个问题:

  • npx 命令运行没有错误,但无法验证它是否使用 max-old-space-size 参数。那么,我这样做对吗?
  • 有没有更好的方法来减少脚本中重复的“./node_modules”?
node.js angular npm package.json npx
1个回答
0
投票

这不起作用,你应该在 --node-options 中包含节点参数。

npx --node-options='--max-old-space-size=10240' ng build --prod

相关: 如何在 npx / npm 版本 7 中使用 --node-arg?

© www.soinside.com 2019 - 2024. All rights reserved.