1

Inside our on-prem server we have a 'product' folder from which our nginx runs our frontend. This product folder contains the build of one of our source folders. Due to this delegation when we build - our assets folder from our source folder overwrite our assets folder from our product folder. This is unacceptable because our assets are changeable by our users, for example: our users can edit the i18n translations from an admin panel.

1). We tried changing our angular.json as such:

          "configurations": {
            "dev": {
            "assets" : []

Script

ng build  --configuration dev --optimization=false --output-path=E:\path\nginx-1.17.4\html\product

The result was that after build assets folder was gone not ignored from overwriting.

2). Then we tried putting the product assets path in the brackets:

      "configurations": {
        "dev": {
          "assets": ["../../../product/assets"]

Script

ng build  --configuration dev --optimization=false --output-path=E:\path\nginx-1.17.4\html\product

Only to receive the following error:

An unhandled exception occurred: The ../../../product/assets asset path must start with the project source root.

3). Then according to this github thread we tried:

  "configurations": {
    "dev": {
      "assets": [{"glob": "**/favicon.png", "input" : "E:/path/nginx-1.17.4/html/product/assets", "output": "assets"}],

Same script.

Result - assets folder not present after build.

Is there a way to not overwrite the assets folder when building to a path different from source path?

Specs

Angular 13.2.3
Node 14.15.1
OS win32 x64

1 Answer 1

0

Use the Angular CLI build option --delete-output-path=false Angular CLI ng build options

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, it does keep the files while building, but result is same. After build is done our assets are being overwritten by the build with previous assets. We want to ignore the assets folder when building.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.