I recently started migrarting a project away from 1.6 to the new Angular 4 (as well of moving to Typescript).
I have a configuration of gulp + watchify/browserify + tisfy which upon changes, automatically add them to a single bundle, which is imported in the html file.
In the old project I used require-globify, so I won't need to require every controller in the project individually, instead I required entire folders (Based on features), then when I added controllers to that feature, they automatically added to the corrosponding module.
Can it be achieved similarly in the new Angular (with Typescript 2). From what is seems, require doesn't work in Typescript, tsify treats the regular imports as require statments, like so:
import {NgModule} from "@angular/core";
import {FirstComponent} from "./my-app/first/first.component";
I don't think manully registering components (and child components!) is maintainable as the project grows (more then welcome to tell me why I'm wrong).
How can I import entire folders and register them as components to the module? Something like this would be awesome (if feasable haha):
import {AppComponent} from "app/root.component";
import * as FirstFeatureComponents from "app/features/first/**/*.component.ts";
@NgModule({
imports: [
BrowserModule,
FormsModule,
RoutingModule
],
declarations: [
AppComponent,
FirstFeatureComponents
],
bootstrap: [AppComponent]
})
export class AppModule {
}