The error happens when I import my LabelModule into the FormFieldModule. Then I use the Label Component in the FormField Component.
I do not import/use those modules/components anywhere else.
This is my FormFieldModule:
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormFieldComponent } from './form-field.component';
import { LabelModule } from '@app/shared';
@NgModule({
declarations: [FormFieldComponent],
imports: [CommonModule, LabelModule],
exports: [FormFieldComponent],
})
export class FormFieldModule {}
This is my LabelModule:
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { LabelComponent } from './label.component';
@NgModule({
declarations: [LabelComponent],
exports: [LabelComponent],
imports: [CommonModule],
})
export class LabelModule {}
The thing is when I import the modules like this, it works.
import { LabelModule } from '@app/shared/components/form-elements/label';
import { ValidationErrorModule } from '@app/shared/components/form-elements/validation-error';
The import shortening works everywhere else. But not here. Another thing I noticed - it works flawlessly when I build the project for production and serve it, no errors, no warnings, it just works. Seems to only be the development issue.