Search code examples
angulartypescriptng-packagr

No provider for InjectionToken ng.v5.defaultTsConfig


I have a problem when I was execute npm run build. In the terminal an error appears:

No provider for InjectionToken ng.v5.defaultTsConfig! (InjectionToken ng.v5.packageTransform -> InjectionToken ng.v5.initTsConfigTransform -> InjectionToken ng.v5.defaultTsConfig)

Additional information, I'm using the library:

  • "@angular/animations": "14.2.8",
  • "@angular/common": "14.2.8",
  • "@angular/compiler": "14.2.8",
  • "@angular/core": "14.2.8",
  • "@angular/forms": "14.2.8",
  • "@angular/platform-browser": "14.2.8",
  • "@angular/platform-browser-dynamic": "14.2.8",
  • "@angular/router": "14.2.8",
  • "ng-packagr": "14.2.2",

How to fix it? I got a similar question, but still no answer : https://github.com/ng-packagr/ng-packagr/issues/2261


Solution

  • add defaultConfiguration

             "development": {
               "tsConfig": "projects/my-library/tsconfig.lib.json"
             }
          },
          "defaultConfiguration": "production"
          }
         },
         "test": {
           "builder": "@angular-devkit/build-angular:karma",