Skip to content

Missing App specific barrels 'shared' #1418

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
francisoud opened this issue Jul 22, 2016 · 3 comments
Closed

Missing App specific barrels 'shared' #1418

francisoud opened this issue Jul 22, 2016 · 3 comments

Comments

@francisoud
Copy link

Was initially created in angular/angular.io#1896 but is an angular-cli error.

I create a sample project from scratch to reproduce the problem: https://github.com/francisoud/angular.io.issue.1896
I have same problem during runtime (in console log) in contract-list.component.ts and for test (as describe above).

You were right the problem is in system-config.ts there are 2 lines that are missing and should have been added during ng generate (see command line below)

// App specific barrels.
  'app',
  'app/shared',
  'app/contracts',
  **'app/contracts/shared',**
  'app/contracts/contract-list',
  **'app/contracts/contract-list/shared'**

I think it's a bug in angular-cli
I think something is missing during ng generate component ... somewhere near this line:
https://github.com/angular/angular-cli/blob/master/addon/ng2/blueprints/component/index.js#L117

Additional info

Errors

Error at runtime
Error in tests

index.ts

It seems to me all index.ts are referencing the correct component:
https://github.com/francisoud/angular.io.issue.1896/blob/bug/src/app/index.ts
https://github.com/francisoud/angular.io.issue.1896/blob/bug/src/app/shared/index.ts
https://github.com/francisoud/angular.io.issue.1896/blob/bug/src/app/contracts/index.ts
https://github.com/francisoud/angular.io.issue.1896/blob/bug/src/app/contracts/contract-list/index.ts
https://github.com/francisoud/angular.io.issue.1896/blob/bug/src/app/contracts/contract-list/shared/index.ts

And they where updated when I created I used ng generate ...

ng generate

C:\tmp\myapp>ng generate component contracts
installing component
  create src\app\contracts\contracts.component.css
  create src\app\contracts\contracts.component.html
  create src\app\contracts\contracts.component.spec.ts
  create src\app\contracts\contracts.component.ts
  create src\app\contracts\index.ts
  create src\app\contracts\shared\index.ts


C:\tmp\myapp>ng generate component contracts/contract-list
installing component
  create src\app\contracts\contract-list\contract-list.component.css
  create src\app\contracts\contract-list\contract-list.component.html
  create src\app\contracts\contract-list\contract-list.component.spec.ts
  create src\app\contracts\contract-list\contract-list.component.ts
  create src\app\contracts\contract-list\index.ts
  create src\app\contracts\contract-list\shared\index.ts

C:\tmp\myapp>ng generate service contracts/shared/contract
installing service
  create src\app\contracts\shared\contract.service.spec.ts
  create src\app\contracts\shared\contract.service.ts

C:\tmp\myapp>tree src
C:\TMP\MYAPP\SRC
└───app
    ├───contracts
    │   ├───contract-list
    │   │   └───shared
    │   └───shared
    └───shared

Sample project

This version with the 2 issues (runtime and test):
https://github.com/francisoud/angular.io.issue.1896/tree/bug

The branch 'workaround':
https://github.com/francisoud/angular.io.issue.1896/tree/workaround (diff)

The branch 'fix':
https://github.com/francisoud/angular.io.issue.1896/tree/fix

Version

C:\tmp\myapp>ng --version
angular-cli: 1.0.0-beta.8
node: 6.2.1
os: win32 x64
@filipesilva
Copy link
Contributor

Closed as this issue was made obsolete by #1455. SystemJS is not used anymore after that PR, so this issue shouldn't happen.

@rameshyala
Copy link

i am added to three model files to my componnent....one file is not loaded like below show example

import {
Company,
Address,
Communication
} from '../models/index';

the company is not loaded to my component,i am add it on model/index also.and one more is in root config component this import barrels not working.

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants