nx lib 负责环境 fileReplacements 不工作

nx lib responsible for environment fileReplacements not working

项目配置:

"common": {
  "root": "libs/common",
  "sourceRoot": "libs/common/src",
  "projectType": "library",
  "architect": {
    "build": {
      "builder": "@nrwl/node:package",
      "outputs": ["{options.outputPath}"],
      "configurations": {
        "production": {
          "fileReplacements": [
            {
              "replace": "libs/common/src/lib/environment.ts",
              "with": "libs/common/src/lib/environment.prod.ts"
            }
          ]
        }
      },
      "options": {
        "outputPath": "dist/libs/common",
        "tsConfig": "libs/common/tsconfig.lib.json",
        "packageJson": "libs/common/package.json",
        "main": "libs/common/src/index.ts",
        "assets": ["libs/common/*.md"]
      }
    }
  },
  "tags": []
}

无法对库进行文件替换。您可以从应用程序配置中进行文件替换,或者例如使用暴露模块中的静态 forRoot 方法使您的 lib 可配置