NX:复制一个额外的文件到构建目录

Kon*_*nia 8 google-app-engine node.js nrwl nrwl-nx

我有一个使用nx构建的项目,并将其部署到 Google App Engine。

它需要app.yaml在同一个文件夹中。

有没有办法告诉 nx 构建器将该额外文件复制到其他所有文件旁边的构建目录中?

Nov*_*evi 11

我想你现在已经明白了,但如果有人仍在寻找解决方案;

您可以为project.json目标指定资产,因此如果需要,app.yaml您可以执行以下操作:

...
"targets": {
    "build": {
      "executor": "@nrwl/js:tsc",
      "outputs": ["{options.outputPath}"],
      "options": {
        "outputPath": "dist/apps/example",
        "main": "apps/example/src/index.ts",
        "tsConfig": "apps/example/tsconfig.app.json",
        "assets": [
          "apps/example/*.md",
          "apps/example/src/app.yaml" <-- specify your path here
        ]
      }
    }
...
Run Code Online (Sandbox Code Playgroud)

  • 这会将 app.yaml 作为资产放在公共目录中 (3认同)