Skip to content

Something changed in fileReplacements and assets with Angular 9 #16779

Closed
@Kunepro

Description

@Kunepro

🐞 Bug report

Command (mark with an x)

  • new
  • [x ] build
  • serve
  • test
  • e2e
  • generate
  • add
  • update
  • lint
  • xi18n
  • run
  • config
  • help
  • version
  • doc

Is this a regression?

Yes, the pipeline to build/deploy was working in Angular 8.2, the behaviour changed migrating to Angular 9.rc10

Description

The way that angular.json configuration for "fileReplacements" and "assets" works has changed.

🔬 Minimal Reproduction

To deploy with CloudFoundry I need to provide an environment specific manifest.yml file.
So I have a manifest.{env}.yml for each environment.

In 8.2, I was specifying to replace the manifest file with "fileReplacements", and then adding the manifest.yml as an "asset" to push to CloudFoundry.

For example for the environment "staging" I would have:
/src/deployment/manifest.staging.yml
/src/deployment/manifest.yml

The first step here would be fileReplacements kicking in, moving the content from manifest.staging.yml inside manifest.yml

The second/last step is manifest.yml being included in dist through the "assets" configuration, but with the staging's configuration inside.

Instead, after migrating to Angular 9.rc10, fileReplacements doesn't happen in time and manifest.yml has the content of the original (non-staging) one.

As a possible fix I tried this approach:
I tried to change my assets configuration to grab directly the manifest file:
{
"glob": "manifest.staging.yml",
"input": "apps/appointment-manager/src/deployment",
"output": "manifest.yml"
},

I expected:
dist/manifest.yml
Instead I got:
dist/manifest.yml/manifest.staging.yml

the output was read as a directory where to place the content.

🔥 Exception or Error

Nope.

🌍 Your Environment


Angular CLI: 9.0.0-rc.10
Node: 12.4.0
OS: win32 x64

Angular: 9.0.0-rc.10
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, localize, platform-browser
... platform-browser-dynamic, router
Ivy Workspace: Yes

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.900.0-rc.10
@angular-devkit/build-angular     0.900.0-rc.10
@angular-devkit/build-optimizer   0.900.0-rc.10
@angular-devkit/build-webpack     0.900.0-rc.10
@angular-devkit/core              9.0.0-rc.10
@angular-devkit/schematics        8.3.23
@angular/cdk                      9.0.0-rc.8
@ngtools/webpack                  9.0.0-rc.10
@schematics/angular               8.3.14
@schematics/update                0.900.0-rc.10
rxjs                              6.5.4
typescript                        3.7.5
webpack                           4.41.2

Anything else relevant?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions