Skip to content

Remove extraneous barrel at the app root #3369

Closed
@johnpapa

Description

@johnpapa

OS?

Mac OSX Sierra

Versions.

angular-cli: 1.0.0-beta.21
node: 6.9.1
os: darwin x64

Repro steps

ng new foo

Details

src/app/foo/index.ts is created and represents a barrel for app.module.ts and app.component.ts

This is referenced from src/app/main.ts

Removing the index.ts file would only require one change in the app:

Before

// main.ts
import { AppModule } from './app/';

After

// main.ts
import { AppModule } from './app/app.module';

Reason:

  1. One less file is easier to read.
  2. One less concept to learn for the user (barrels)
  3. It only used in one place, so it is easy to code without the barrel

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions