Skip to content
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

Importing const from barrel = undefined #72

Closed
montella1507 opened this issue Sep 18, 2017 · 7 comments
Closed

Importing const from barrel = undefined #72

montella1507 opened this issue Sep 18, 2017 · 7 comments
Labels
🤷‍♂️ Needs More Info waiting for more information from author of the issue

Comments

@montella1507
Copy link

//index.ts
import * as components from './components';

export const COMPONENTS = [
components.WidgetComponent
];

// module.ts
import { COMPONENTS } from './index';
@NgModule({
declarations: [
...COMPONENTS
],

= components are undefined.

@thymikee
Copy link
Owner

Hi @montella1507, thanks for your report, but this doesn't tell much. A repo with the issue would be helpful.

@montella1507
Copy link
Author

Hello,

ok i will try to simulate it in your example app.

@thymikee thymikee added the 🤷‍♂️ Needs More Info waiting for more information from author of the issue label Oct 2, 2017
@montella1507
Copy link
Author

@thymikee i have resolved my issue, yet i dont know why it occurs..

my project structure:
/src
app.module.ts
/shared
/models
/app
index.ts

That index.ts was reexported:
export * from './app';
it works for every build - ng build, ngc build, aot build.. but with JEST..

it takes "from './app'" as app.module.ts file.. So it is error...

@thymikee
Copy link
Owner

thymikee commented Oct 2, 2017

Try the latest version of the preset

@montella1507
Copy link
Author

Current:
jest-preset-angular@^2.0.5

i would try and i will let you know.

@montella1507
Copy link
Author

4.0.0-beta.1 works. Thank you :-))

Uff. i have spent 6 hours on everything :-) Reworked imports, tried to get rid of several barrels... Madge tool, ng tool for circullar dependencies :D unfortunately i just had to wait for the new version of preset :-)

@thymikee
Copy link
Owner

thymikee commented Oct 2, 2017

The fix for issues like this was a part of v3, which was released some time ago. Glad it worked for you :)

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤷‍♂️ Needs More Info waiting for more information from author of the issue
Projects
None yet
Development

No branches or pull requests

2 participants