Parul
Parul

Reputation: 31

How to add angular builder/custom webpack for different environment?

Currently I am using the custom builder for "serve" in angular.json file, like this

"serve": {
          "builder": "@angular-builders/custom-webpack:dev-server",
          "options": {
            "browserTarget": "app:build"
          },
          "configurations": {
            "production": {
              "browserTarget": "app:build:production"
            },
            "qa": {
              "browserTarget": "app:build:qa"
            },
            "local": {
              "browserTarget": "app:build:local"
            },
}

I have tried to add builder option inside "local" also, but it is not working , so Is there any way to add this builder for "serve local" ?

Upvotes: 2

Views: 937

Answers (1)

Amer
Amer

Reputation: 6716

You can add it directly under architect > build to be enabled for all environments:

"architect": {
    "build": {
        "builder": "@angular-builders/custom-webpack:browser",
        "options": {
            "customWebpackConfig": {
                "path": "./webpack.config.js",
                "replaceDuplicatePlugins": true
            },
         ....

Upvotes: 0

Related Questions