Angular 8 typescript file replacement error

433 views Asked by At

I'm replacing html files with angular.js configurations, but if I need to replace a typescript file from component, it shows errors. I'm using angular 8.

angular.js

"production": {
  "fileReplacements": [
    {
      "replace": "src/environments/environment.ts", // GOOD
      "with": "src/environments/environment.prod.ts"
    },
    {
      "replace": "src/theme.css", // GOOD
      "with": "src/theme.prod.css"
    },
    {
      "replace": "src/app/login/login.component.html", // GOOD
      "with": "src/app/login/login.component.prod.html"
    },
    {
      "replace": "src/app/login/login.component.ts", // ERROR
      "with": "src/app/login/login.component.prod.ts"
    }
  ],

error:

ERROR in : Cannot determine the module for class LoginComponent in /src/app/login/login.component.prod.ts! Add LoginComponent to the NgModule to fix it.

I have this component header in "prod" and "normal" file.

@Component({
  selector: 'app-login',
  templateUrl: './login.component.html',
  styleUrls: ['./login.component.css']
})

Is there a way to replace typescript file from component?

0

There are 0 answers