Barrels. Did latest RC0 or ng2 final release break them?

import { BackEndService } from "../../../shared";

fails now, giving infamous [Service1, ?, Service2] error. Now I changed code back to where we were before beta11

import { BackendService } from "../../../shared/backend/backend.service";

and it works.

My serious question would be how often I need to change all of my 500 Components and 30 Services back and forth with barells? Roadmap: RC1 - Barells switched on again. RC2 - Barells switched off, RC3 Barells switched on? Sorry to sound grim, but this situation would drive any Developer mental.

AFAIK barrels are no longer recommended after the introduction of NgModules in Angular 2. See e.g. this comment on the Angular Gitter chat.

I agree that all the changes in Angular 2 RCs have been a pain and not something you’d normally expect in a release candidate.

On the plus side Angular 2 is now stable and they finally decided to follow semantic versioning like most other projects so no more breaking changes until Angular 3.

1 Like