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

Issue: Encountered undefined provider for ngx-material-timepicker #91

Closed
joelduncan1 opened this issue Dec 31, 2018 · 7 comments
Closed

Comments

@joelduncan1
Copy link

npm: 6.5.0
node: 8.11.4
angular: 6.0.8

[ISSUE]
npm build:prod having an issue detecting ngx-material-timepicker have an undefined providers for version 2.11.1

[ALTERNATIVE]
I reverted my node module for ngx-material-timepicker to 2.8.4 and it works.

@joelduncan1 joelduncan1 changed the title Issue: Encountered undefined provider! Usually this means you have a circular dependencies Issue: Encountered undefined provider for ngx-material-timepicker Dec 31, 2018
@mal90
Copy link

mal90 commented Dec 31, 2018

Can confirm. I am also getting the same error :
Encountered undefined provider! Usually this means you have a circular dependencies (might be caused by using 'barrel' index.ts files

@IlCallo
Copy link

IlCallo commented Jan 1, 2019

Confirm too, with this errors (only with AOT compilation)

ERROR in : Unexpected value 'undefined' exported by the module 'NgxMaterialTimepickerModule in [...]/node_modules/ngx-material-timepicker/ngx-material-timepicker.d.ts'

ERROR in : Encountered undefined provider! Usually this means you have a circular dependencies. This might be caused by using 'barrel' index.ts files.

EDIT
This is probably due to your usage of barrel files, which you added in latest commit.
Barrel files are a bit tricky and it's probably better to avoid them intra-library.

Here you used ../models instead of the full references.

Or here you used them to import everything into the library module

import {
NgxMaterialTimepicker12HoursFaceComponent,
NgxMaterialTimepicker24HoursFaceComponent,
NgxMaterialTimepickerButtonComponent,
NgxMaterialTimepickerDialComponent,
NgxMaterialTimepickerDialControlComponent,
NgxMaterialTimepickerFaceComponent,
NgxMaterialTimepickerMinutesFaceComponent, NgxMaterialTimepickerPeriodComponent,
NgxMaterialTimepickerToggleComponent
} from './components';
import {
AutofocusDirective,
NgxMaterialTimepickerThemeDirective,
NgxMaterialTimepickerToggleIconDirective, OverlayDirective,
TimepickerDirective
} from './directives';
import {MinutesFormatterPipe, StyleSanitizerPipe, TimeFormatterPipe} from './pipes';
import {NgxMaterialTimepickerEventService, NgxMaterialTimepickerService} from './services';

The problem is probably in one (or more) of this imports

@IlCallo
Copy link

IlCallo commented Jan 1, 2019

I confirm error disappears downgrading to 2.11.0

@ErickXavier
Copy link

I also confirm the issue. Added a console.log('type', type) in the line 18783 of the file ngx-material-timepicker/src/app/material-timepicker/ngx-material-timepicker.module.ts and this popped up:

type { ngModule: StaticSymbol { filePath: 'C:/Users/admin/Projects/my-project/node_modules/ngx-material-timepicker/ngx-material-timepicker.d.ts', name: 'NgxMaterialTimepickerModule', members: [] }, providers: [ undefined, undefined ] }

@Agranom
Copy link
Owner

Agranom commented Jan 3, 2019

I'll find out the problem and fix it in the next two days. Sorry for this.

@IlCallo
Copy link

IlCallo commented Jan 3, 2019

No problem man, it's still open source stuff you give away for free.
Take your time, and thank you :)

@Floaz Floaz mentioned this issue Jan 4, 2019
@Agranom
Copy link
Owner

Agranom commented Jan 7, 2019

Fixed. Update to 2.11.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants