I have a components module:
/* root/src/components/components.module.ts */
import { NgModule } from '@angular/core';
// (other imports)
@NgModule({
declarations: [/*components*/],
exports: [/*components*/]
})
export class ComponentsModule {}
When I try to import it into app.module.ts…
/* root/src/app/app.module.ts */
import { NgModule } from '@angular/core';
// (other imports)
import { ComponentsModule } from '../components';
@NgModule({
imports: [ ComponentsModule ]
})
export class AppModule {}
I get the error Cannot find module "../components"
.
However, if I import it like:
import { ComponentsModule } from '../components/components.module.ts';
or change components.module.ts to index.ts then it all works fine.
Why does my original attempt not work? Is there a way to make it work that way?