just-jeb / angular-builders

Angular build facade extensions (Jest and custom webpack configuration)
MIT License
1.14k stars 198 forks source link

Ng build error with `Unknown argument: configuration` #1223

Closed squelix closed 2 years ago

squelix commented 2 years ago

Describe the Bug

When i launch the command yarn ng run loyalty-v3:build --configuration=production on GitlabCI it's not working with error Error: Unknown argument: configuration. But on my localhost environment it's working :/

I tried with the default builder @angular-devkit/build-angular:browser and i have the same error.

Minimal Reproduction

Launch command yarn ng run loyalty-v3:build --configuration=production on CI.

Expected Behavior

Command yarn ng run loyalty-v3:build --configuration=production should work.

Screenshots

image

Environment

yarn ng version on CI

image

Libs
- @angular/core version: 14.0.2
- @angular-devkit/build-angular version: 14.0.2
- @angular-builders/custom-webpack version: 14.0.0

For Tooling issues:
- Node version: 14.18
- Platform:  
  - Localhost: Mac
  - CI: Docker image Node so Linux

angular.json

{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "version": 1,
  "newProjectRoot": "projects",
  "projects": {
    "loyalty-v3": {
      "projectType": "application",
      "schematics": {
        "@schematics/angular:component": {
          "style": "scss",
          "changeDetection": "OnPush",
          "skipImport": true
        }
      },
      "root": "",
      "sourceRoot": "src",
      "prefix": "app",
      "architect": {
        "build": {
          "builder": "@angular-builders/custom-webpack:browser",
          "options": {
            "outputPath": "dist/loyalty-v3",
            "index": "src/index.html",
            "main": "src/main.ts",
            "polyfills": "src/polyfills/index.ts",
            "tsConfig": "src/tsconfig.app.json",
            "aot": true,
            "assets": [
              "src/assets/commons.svg",
              "src/assets",
              "src/favicon.ico",
              {
                "glob": "**/*",
                "input": "node_modules/@taiga-ui/icons/src",
                "output": "assets/taiga-ui/icons"
              }
            ],
            "styles": [
              "node_modules/@taiga-ui/core/styles/taiga-ui-global.less",
              "node_modules/@taiga-ui/core/styles/taiga-ui-theme.less",
              {
                "input": "src/styles/main.scss"
              }
            ],
            "stylePreprocessorOptions": {
              "includePaths": ["src/styles", "src/styles/layout", "src/styles/theme"]
            },
            "scripts": [],
            "customWebpackConfig": {
              "path": "src/webpack.config.js"
            },
            "allowedCommonJsDependencies": [
              "element-resize-detector",
              "qs",
              "angular2-text-mask",
              "deep-equal",
              "clone-deep",
              "chart.js",
              "chartjs-plugin-annotation",
              "html-entities"
            ],
            "indexTransform": "src/index-html-transform.ts",
            "sourceMap": true,
            "optimization": false,
            "buildOptimizer": false,
            "vendorChunk": true,
            "extractLicenses": false,
            "namedChunks": true
          },
          "configurations": {
            "production": {
              "fileReplacements": [
                {
                  "replace": "src/environments/build-config.ts",
                  "with": "src/environments/build-config.prod.ts"
                }
              ],
              "optimization": true,
              "outputHashing": "all",
              "namedChunks": false,
              "extractLicenses": true,
              "vendorChunk": true,
              "buildOptimizer": true,
              "budgets": [
                {
                  "type": "bundle",
                  "name": "polyfills",
                  "baseline": "150kb",
                  "maximumWarning": "50kb",
                  "maximumError": "100kb"
                },
                {
                  "type": "bundle",
                  "name": "styles",
                  "baseline": "280kb",
                  "maximumWarning": "50kb",
                  "maximumError": "100kb"
                },
                {
                  "type": "bundle",
                  "name": "main",
                  "baseline": "1024kb",
                  "maximumWarning": "100kb",
                  "maximumError": "200kb"
                },
                {
                  "type": "anyComponentStyle",
                  "maximumError": "6kb"
                }
              ]
            }
          }
        },
        "serve": {
          "builder": "@angular-builders/custom-webpack:dev-server",
          "options": {
            "browserTarget": "loyalty-v3:build",
            "proxyConfig": "proxy.config.json"
          },
          "configurations": {
            "production": {
              "browserTarget": "loyalty-v3:build:production"
            }
          }
        },
        "lint": {
          "builder": "@angular-eslint/builder:lint",
          "options": {
            "lintFilePatterns": ["src/**/*.ts", "global/**/*.ts", "server/**/*.ts", "src/**/*.html"]
          }
        },
        "storybook": {
          "builder": "@storybook/angular:start-storybook",
          "options": {
            "browserTarget": "loyalty-v3:build",
            "compodoc": false,
            "port": 6006
          }
        },
        "build-storybook": {
          "builder": "@storybook/angular:build-storybook",
          "options": {
            "browserTarget": "loyalty-v3:build",
            "compodoc": false
          }
        },
        "server": {
          "builder": "@angular-builders/custom-webpack:server",
          "options": {
            "customWebpackConfig": {
              "path": "server/webpack.config.js"
            },
            "stylePreprocessorOptions": {
              "includePaths": ["src/styles/"]
            },
            "outputPath": "dist/server",
            "main": "server/server.ts",
            "tsConfig": "server/tsconfig.server.json",
            "externalDependencies": [
              "@nestjs/microservices",
              "@nestjs/microservices/microservices-module",
              "@nestjs/websockets/socket-module",
              "@nestjs/platform-express",
              "cache-manager",
              "class-transformer",
              "class-validator"
            ],
            "sourceMap": true,
            "optimization": false
          },
          "configurations": {
            "production": {
              "outputHashing": "media",
              "fileReplacements": [
                {
                  "replace": "src/environments/build-config.ts",
                  "with": "src/environments/build-config.prod.ts"
                }
              ],
              "sourceMap": true,
              "optimization": false
            }
          }
        }
      }
    }
  },
  "cli": {
    "analytics": false
  }
}
just-jeb commented 2 years ago

Angular CLI issue: https://github.com/angular/angular-cli/issues/23385