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

AOT: Encountered undefined provider! Error: The Angular AoT build failed. #30

Open
huan opened this issue Apr 10, 2018 · 1 comment
Open
Labels

Comments

@huan
Copy link
Member

huan commented Apr 10, 2018

When this module is imported by @chatie/app, npm run ionic:build --aot said Encountered undefined provider!.

After diving into the code, the issue Chatie/app#33 is caused by this module @chatie/db.

Even an empty empty import could be able to cause the error message:

Encountered undefined provider! Error: The Angular AoT build failed. Usually this means you have a circular dependencies (might be caused by using 'barrel' index.ts files.

import {} from '@chatie/db'

Wired.

See Also

@huan
Copy link
Member Author

huan commented Apr 11, 2018

UPDATE

I found this issue caused by using 'barrel' index.ts files, just as the error message said.

However, it's very strange that it's just a very simple barrel index.ts, there are no circle dependencies at all.

db/src/db.module.ts

Lines 9 to 15 in de17acc

import { Db } from './db'
import { BotieStore } from './botie/'
import {
GraphCoolIdToken,
} from './config'
import { GiftieStore } from './giftie'
import { HostieStore } from './hostie'

If I change the above code to

- import { BotieStore }   from './botie/'
+ import { BotieStore }   from './botie/botie-store'
- import { GiftieStore }  from './giftie'
+ import { GiftieStore }  from './giftie/giftie-store'
- import { HostieStore }  from './hostie'
+ import { HostieStore }  from './hostie/hostie-store'

Then it will work with AOT in @chatie/app.

Wired.

@huan huan added the bug label Apr 11, 2018
@huan huan changed the title AOT compile error when import by @chatie/app AOT: Encountered undefined provider! Error: The Angular AoT build failed. Apr 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant