GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Mixing configurations · Issue #10612 · angular/angular-cli

Mixing configurations #10612

New issue
Copy link
New issue
Copy link
Closed
#15819
Closed
Mixing configurations#10612
#15819
Copy link
Labels
P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentAn issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: @angular-devkit/architectarea: @angular/clifeatureLabel used to distinguish feature request from other issuesLabel used to distinguish feature request from other issues
Milestone
Backlog

Description

@ocombe
ocombe
opened on May 3, 2018
Issue body actions

Versions

v6

Observed behavior

You cannot use --prod with a custom configuration since --prod is an alias for --configuration=production. This means that if I make a custom configuration for my project, I need to duplicate it for the prod build to include everything from the production configuration.

Desired behavior

I'd like to be able to mix configurations, where each one overwrites the precedent. For example with -c=prod,xxx, where xxx overwrites production values if they both define the same property

For example if I'm doing i18n, I would like to have something like that:

          "configurations": {
            "production": {
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.prod.ts"
                }
              ],
              "optimization": true,
              "outputHashing": "all",
              "sourceMap": false,
              "extractCss": true,
              "namedChunks": false,
              "aot": true,
              "extractLicenses": true,
              "vendorChunk": false,
              "buildOptimizer": true
            },
            "fr": {
              "aot": true,
              "outputPath": "dist/my-project-fr/",
              "i18nFile": "src/locale/messages.fr.xlf",
              "i18nFormat": "xlf",
              "i18nLocale": "fr",
              "i18nMissingTranslation": "error"
            }
          }
        },

And use -c=production,fr, or --prod -c=fr

Reacted by Ryan Lester, Elvis Begovic, D, Jimmy Segers, Martin Nyolt, Radoslav Kirilov, Mick Lawitzke, Tomasz Błachut, Alireza Mirian, rmsmq and 127 more
Reacted by Gautier P, Vasilis Diakomanolis, Klemen Oslaj, Максим Иванов, Ismael Ramos and Antonio Genaro
Reacted by Rijin Elayambari, Gautier P, Vasilis Diakomanolis, Klemen Oslaj, Максим Иванов, Allen, Thomas Bianchi, Ismael Ramos, Yash Kadaru and Antonio Genaro
Reacted by Gautier P, Robert J. Kusznier, Vasilis Diakomanolis, Gustav Bylund, ksz ksz, Klemen Oslaj, Максим Иванов, Allen, Ismael Ramos, Kai Lehmann and 4 more
Reacted by Krzysztof Marian Raciniewski, Gautier P and Antonio Genaro
Reacted by Gregory Zhukovsky, Tobias Friedinger, Marcus Abrahamsson, Tomas, Gautier P and Antonio Genaro

Activity

Next
  1. filipesilva commented on May 3, 2018

    @filipesilva
    filipesilva
    on May 3, 2018
    Contributor
    More actions

    @buu700 was also interested in something similar in #10559

    Reacted by Ryan Lester
  2. hansl
    added this to the v6.1.0 milestone on May 3, 2018
  3. phl3x0r commented on May 4, 2018

    @phl3x0r
    phl3x0r
    on May 4, 2018
    More actions

    That would be a great addition.
    At the moment (in the 1.x.x config) I have a setup with many apps sharing a lot of the same (duplicate) configuration. I was hoping that 6.0 would provide a way to share common configuration between app flavors, but at this point, the config will just be even more bloated than before.
    In my case it's not the i18n files (although potentially it will be in the future), but assets, styles and environment files that changes between customers (apps).

  4. hansl
    added
    P5The team acknowledges the request but does not plan to address it, it remains open for discussionThe team acknowledges the request but does not plan to address it, it remains open for discussion
    featureLabel used to distinguish feature request from other issuesLabel used to distinguish feature request from other issues
    on May 4, 2018
  5. MickL commented on Jun 14, 2018

    @MickL
    MickL
    on Jun 14, 2018
    More actions

    Alternative to using multiple configurations they could have a extend feature as mentioned here: #11233 . Definitely need either one of them.

  6. MickL commented on Jun 14, 2018

    @MickL
    MickL
    on Jun 14, 2018
    More actions

    @hansl Personally i would set this issue to priority 2 (required). Instead of:

    ng build -c=prod,theme1,en and ng serve -c=theme1,en

    we have to make TONS configurations with TONS of duplicate code:

    "build": {
       ...
        "configurations": {
            "theme1": {
                // Asset configuration theme 1
            },
            "theme1-en": {
                // Asset configuration theme 1
                // Load language files EN
            },
            "theme1-prod-en": {
                // Production settings
                // Asset configuration theme 1
                // Load language files EN
            },
            "theme1-de": {
                // Asset configuration theme 1
                // Load language files DE
            },
            "theme1-prod-de": {
                // Production settings
                // Asset configuration theme 1
                // Load language files DE
            },
             "theme2": {
                // Asset configuration theme 2
            },
            "theme2-en": {
                // Asset configuration theme 2
                // Load language files EN
            },
            "theme2-prod-en": {
                // Production settings
                // Asset configuration theme 2
                // Load language files EN
            },
            "theme2-de": {
                // Asset configuration theme 2
                // Load language files DE
            },
            "theme2-prod-de": {
                // Production settings
                // Asset configuration theme 2
                // Load language files DE
            },
        }
    },
    "serve": {
        "builder": "@angular-devkit/build-angular:dev-server",
        "options": {
            "browserTarget": "myapp:build"
        },
        "configurations": {
            "theme1": {
                "browserTarget": "myapp:build:theme1"
            },
            "theme1-en": {
                "browserTarget": "myapp:build:theme1-en"
            },
            "theme1-de": {
                "browserTarget": "myapp:build:theme1-de"
            },
            "theme1-prod-en": {
                "browserTarget": "myapp:build:theme1-prod-en"
            },
            "theme1-prod-de": {
                "browserTarget": "myapp:build:theme1-prod-de"
            },
            "theme2": {
                "browserTarget": "myapp:build:theme2"
            },
            "theme2-en": {
                "browserTarget": "myapp:build:theme2-en"
            },
            "theme2-de": {
                "browserTarget": "myapp:build:theme2-de"
            },
           "theme2-prod-en": {
                "browserTarget": "myapp:build:theme2-prod-en"
            },
            "theme2-prod-de": {
                "browserTarget": "myapp:build:theme2-prod-de"
            },
        }
    }
    

    And this was just 2 themes and 2 languages. It multiplies for each other theme or language...

    Reacted by Florian Reisecker, Tomasz Błachut, derdeka, Mohammed El Batya, Solution, Piotr Żurek, erex1, Kevin Kessenich, Vitaly Iegorov, Anders Törnkvist and 19 more
  7. phl3x0r commented on Jun 16, 2018

    @phl3x0r
    phl3x0r
    on Jun 16, 2018
    More actions

    Looks like our situation. 30+ configurations x 6 different environments = wall of config

    Reacted by Alex
  8. rmsmq commented on Jul 27, 2018

    @rmsmq
    rmsmq
    on Jul 27, 2018
    More actions

    Alternative to using multiple configurations they could have a extend feature as mentioned here: #11233 . Definitely need either one of them.

    Unless I am misunderstanding, I don't think this will reduce the number of configurations, only duplication within the configurations.

    I would prefer the proposed solution in this issue, which should allow for significantly less configurations.

    Reacted by S. Mahdi Mir-Ismaili
  9. paulheising commented on Aug 16, 2018

    @paulheising
    paulheising
    on Aug 16, 2018
    More actions

    +1

    would definitely need such a feature!

    Reacted by Mohammed El Batya, M.Sakamaki, fimbulwint, Gautier P, erex1, Robin De Schepper, Atul Kumar, S. Mahdi Mir-Ismaili, Nitsan Baleli and gekkedev
    Reacted by Gregory Zhukovsky
  10. PhoneixS commented on Sep 26, 2018

    @PhoneixS
    PhoneixS
    on Sep 26, 2018
    More actions

    I think that it should be mentioned in the documentation in Deployment because nowadays it is in i18n:

    For production builds, you define a separate production-fr build configuration in the CLI configuration file, angular.json.

  11. robertjk commented on Oct 1, 2018

    @robertjk
    robertjk
    on Oct 1, 2018
    More actions

    I also think this feature is essential to write maintainable, clean configurations, especially when you implement internationalization.

    I wonder if this problem could also be solved by allowing angular.json to be written in YAML (angular.yaml), as YAML lets you declare anchors to duplicate properties.

    Reacted by Andreas Osberghaus, Bart de Ruijter, Kansen, Alwin Schoemaker, Cédric Belin, S. Mahdi Mir-Ismaili, nomeaning, Gregory Zhukovsky, Salah Loukili, Summer Phillips and 1 more
  12. wulfsberg commented on Oct 6, 2018

    @wulfsberg
    wulfsberg
    on Oct 6, 2018
    More actions

    I agree with @MickL that this is beyond a "nice to have". Even something as trivial as changing the default locale (for pipes) explodes into a barrage of cut'n'paste all over the already-not-too-friendly angular.json.

    Reacted by Niklas Hegnelt, Salah Loukili, dbPieter and Jakob Kofod Beyer
  13. splincode commented on Dec 26, 2018

    @splincode
    splincode
    on Dec 26, 2018
    More actions

    @mgechev it would be cool to be able to inherit

    "build": {
      ...
      "configurations": {
        "production": {
          (...)
        },
        "pl": {
          "extends": "config/pl.angular.json",
          (...)
        },
        "en": {
          "extends": "config/en.angular.json",
          (...)
        }
      }
    }
    Reacted by Ringo , Spawnrad, Niklas Hegnelt, Kansen, Miguel Leon, Laurent Goudet, Dominic Foti Jr., Monwoo, Alexey, TMTron and 12 more
  14. phl3x0r commented on Jan 4, 2019

    @phl3x0r
    phl3x0r
    on Jan 4, 2019
    More actions

    I think this issue needs more attention.
    Our angular.json file is currently 14048 lines and growing, not even counting the multitude of i18n configurations that are yet to be implemented.

    Reacted by Mick Lawitzke, Sergey Fetiskin, Dominic Foti Jr., Monwoo, Domas Trijonis, developer112, Radoslav Kirilov, Matt, Robin De Schepper, Pete and 23 more
    Reacted by Romko and Hung Q. Le
    Reacted by Ray Chavez, Aleksandr Vishniakov, Tadeusz and Julian
  15. 13 remaining items

  16. filipesilva
    added
    needs: discussionOn the agenda for team meeting to determine next stepsOn the agenda for team meeting to determine next steps
    on Aug 8, 2019
  17. abariatti commented on Aug 12, 2019

    @abariatti
    abariatti
    on Aug 12, 2019
    More actions

    I compile it and run as node angular.js before build and serve commands (I use npm run build, npm run start which internally call this task).

    @asvishnyakov Would you have the awesomness of providing a running gist?

  18. asvishnyakov commented on Aug 18, 2019

    @asvishnyakov
    asvishnyakov
    on Aug 18, 2019
    More actions

    @abariatti I cannot show you full code because of my contract limitations, but the idea is simple.

    Add angular.ts and put your current json to it as typescript object, i.e.

    const angularJson = { ... };

    Then add output to the angular.json:

    const fs = require('fs');
    const angularJson = { ... };
    fs.writeFileSync('angular.json', JSON.stringify(angularJson, null, 4), 'utf8');

    Now, in packages.json add tasks to compile and run it:

    {
      "scripts": {
        "angular-json:build": "tsc --moduleResolution node --lib es2018 --outFile angular.js angular.ts",
        "angular-json:transform": "npm run angular-json:build && node angular.js",

    Then run angular-json:transform task manually every time you change angular.ts or add it before every build or run task in packages.json:

    {
      "scripts": {
        "build": "npm run angular-json:transform && ng build"
    Reacted by LAKE A. KAMSON, Yahya Uddin, Arnaud 2501, dodos90, Markus Hettich and Daniel Antenor Soares
  19. filipesilva
    added 6 commits that reference this issue on Oct 11, 2019

    feat(@angular/cli): support using multiple configurations

    a5653c3

    feat(@angular/cli): support using multiple configurations

    2d2d25b

    feat(@angular/cli): support using multiple configurations

    c67eb81

    feat(@angular/cli): support using multiple configurations

    56e654a

    feat(@angular/cli): support using multiple configurations

    249abf0

    feat(@angular/cli): support using multiple configurations

    55c1699
  20. vikerman
    closed this as completedin #15819on Oct 14, 2019
  21. vikerman
    added a commit that references this issue on Oct 14, 2019

    feat(@angular/cli): support using multiple configurations

    65c2a19
  22. angular-automatic-lock-bot commented on Nov 14, 2019

    @angular-automatic-lock-bot
    angular-automatic-lock-botBot
    on Nov 14, 2019
    More actions

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  23. angular-automatic-lock-bot
    locked and limited conversation to collaborators on Nov 14, 2019
  24. alan-agius4
    removed
    needs: discussionOn the agenda for team meeting to determine next stepsOn the agenda for team meeting to determine next steps
    on Dec 5, 2019
  25. mostafaibr
    added a commit that references this issue on May 29, 2026

    feat(@angular/cli): support using multiple configurations

    378dc79
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentAn issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: @angular-devkit/architectarea: @angular/clifeatureLabel used to distinguish feature request from other issuesLabel used to distinguish feature request from other issues

    Type

    No type

    Projects

    No projects

      Milestone

      • BacklogNo due date

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.