0

I'm trying to import an NgModule into a standalone component but the compiler is throwing the error NG2012 : Component imports must be standalone components, directives, pipes, or must be NgModules.

NgModule({
  declarations: [FooComponent],
  exports: [FooComponent],
});
export class FooModule {}

let comps = [ImageComponent, HighlightDirective];

@Component({
  selector: 'app-root',
  standalone: true,
  imports: [FooModule],
  template: ``,
})
export class ExampleStandaloneComponent {}
Matthieu Riegler
  • 31,918
  • 20
  • 95
  • 134

1 Answers1

1

I lost over 30 minutes, on this.

The NgModule is malformed : NgModule should have been @NgModule.

Matthieu Riegler
  • 31,918
  • 20
  • 95
  • 134