为什么YARN_FLAGS被忽略?

时间:2018-10-24 15:35:07

标签: netlify

我很难弄清为什么不使用YARN_FLAGS

# Related to YARN_FLAGS https://git.io/fx1W5  https://git.io/fx1RF  # debug with --verbose
[build]
  base    = "./services/frontend"
  command = "echo $YARN_FLAGS && yarn build" 
  publish = "./services/frontend/build"

[build.environment]
  NODE_VERSION = "10.12.0"
  YARN_FLAGS = "--ignore-optional --frozen-lockfile --network-timeout 1000000 --network-concurrency 1 --verbose"

[context.production.environment]
  NODE_ENV = "production"

[context.deploy-preview.environment]
  NODE_ENV = "test"

[[redirects]]
  from = "/*"
  to = "/index.html"
  status = 200

https://app.netlify.com/sites/monstereos-gabo/deploys/5bd08b5bc965924622aeccce

1 个答案:

答案 0 :(得分:1)

根据是否存在yarn.lockpackage.lock以及如何处理YARN_FLAGS的{​​{3}}。

  

如果有/yarn.lock文件:可以设置YARN_VERSION(任何发行版本),YARN_FLAGS(传递给我们的自动纱线安装的标志,在存在此文件时运行)。默认情况下,YARN_FLAGS设置为--ignore-optional。如果您有/yarn.lock,则关于下一步的/package.json文件将被忽略!

确保将yarn.lock文件推送到存储库中。看起来,当锁定文件存在时,构建过程决定使用flags环境变量。

注意: :在将Clear build cache文件推送到存储库后,您可能希望触发部署和yarn.lock以取得良好效果。< / p>

Netlify docs tell us that they make specific decisions