angularwebpackangular-aotng-build

Can't resolve all parameters (AOT, buildOptimizer) on Staging & Prod (ng serve works)


I just upgraded from 5 to 8. It works (and really fast) when ng-serve. It also works when I do ng-build. But when I tell it to build on

ng build --configuration=staging

I get

ERROR in Can't resolve all parameters for CandidateViewComponent ([object Object], [object Object])

But if I change "aot" & "buildOptimizer" to false (in angular.json) it does build successfully.

angular.json:

            "staging": {
              "optimization": true,
              "outputHashing": "all",
              "sourceMap": false,
              "extractCss": true,
              "namedChunks": false,
              "aot": true,
              "extractLicenses": true,
              "vendorChunk": false,
              "buildOptimizer": true,
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.staging.ts"
                }
              ]
            }

Solution

  • Whoever is reading this, I found the problem. Turns out that from some reason was an added character to the import path:

    import { SelectedCompanyService } from 'app/shared/_services/\u200F\u200Fselected-company.service';
    

    the "\u200F\u200F"

    I deleted it and it works.

    Thanks for all the helpers!