NMilicic / ngx-bootstrap-product-tour

Angular product tour library
MIT License
12 stars 16 forks source link

Bundled version of component failing. #10

Open evm2556 opened 6 years ago

evm2556 commented 6 years ago

Im using Angular-cli to bundle my app. There is an error when the popoverDirective.show is being called.

main.bundle.js:1 ERROR Error: No component factory found for t. Did you add it to 
@NgModule.entryComponents?
    at we (main.bundle.js:1)
    at t.resolveComponentFactory (main.bundle.js:1)
    at t.attach (main.bundle.js:1)
    at e.t.show (main.bundle.js:1)
    at t.showTourStep (main.bundle.js:1)

I have routing module and ngx-bootstrap as a part of my project. Anything additional that needs ot be done?

NMilicic commented 6 years ago

@evm2556 You don't need anything else, you just add NgxBootstrapProductTourModule.forRoot() to your module.

But this looks like some error with ngx-bootstrap. What version of ngx-bootstrap are you using?

P.S. Maybe it will help you have demo src code here

evm2556 commented 6 years ago

Im using ngx-bootstrap": "^2.0.5, "ngx-bootstrap-product-tour": "^2.0.2. Ill continue to try and debug, im able to reproduce with ng serve --aot within my app. Now i can see non-bundled errors.

Looks like this issue. https://github.com/isaacplmann/ngx-tour/issues/80

core.js:1449 ERROR Error: No component factory found for PopoverContainerComponent. Did you add it to @NgModule.entryComponents?
    at noComponentFactoryError (core.js:3929)
    at CodegenComponentFactoryResolver.resolveComponentFactory (core.js:3993)
    at ComponentLoader.attach (component-loader.class.js:45)
    at NgxBootstrapPopoverDirective.PopoverDirective.show (ngx-bootstrap-product-tour.es5.js:834)
    at NgxBootstrapProductTourDirective.showTourStep (ngx-bootstrap-product-tour.es5.js:16150)
    at NgxBootstrapProductTourService.showStep (ngx-bootstrap-product-tour.es5.js:16040)
    at NgxBootstrapProductTourService.setCurrentStep (ngx-bootstrap-product-tour.es5.js:16022)

I downgraded to ngx-bootstrap 2.0.4, deleted from node_modules, and reinstalled/reset app. Same issue.

evm2556 commented 6 years ago

The issue is that there are 2 references to PopoverContainerComponent. one from ngx-bootstrap-product-tour and one from ngx-bootstrap. When angular tries to resolve the reference it does ngx-bootstrap-product-tour.PopoverContainerComponent === ngx-bootstrap.PopoverContainerComponent and that fails. Sorry if this doesnt make sense. If you npm install ngx-bootstrap-product-tour into an app you can see it in node_modules\ngx-bootstrap-product-tour\ngx-bootstrap-product-tour.es5.js, trying to make a plunker for it now.

salmaarsh06 commented 6 years ago

@NMilicic : did you find any solution for it .

igormap42 commented 6 years ago

Have the same problem in aot mode. Any idea how to solve it?

evm2556 commented 6 years ago

I was not able to resolve this issue.

salmaarsh06 commented 6 years ago

I just copied the source code from lib folder here and added it to my source code . it finally worked . PS: its not a solution but still a workaround .

evm2556 commented 6 years ago

I did do try that and got it working, but again, thats not using the bundled version.

salmaarsh06 commented 6 years ago

is ng serve working fine ?? u need to import everything from the copied folder now . as i have kept it under assets . so now import statements go like this import { NgxBootstrapProductTourService } from 'assets/ngx-bootstrap-product-tour';

long241191 commented 6 years ago

I Have the same problem in aot mode. Any idea how to solve it?

salmaarsh06 commented 6 years ago

@long241191 : there has been no soluion for that for now as i was unable to find it . but u can use the workaround that has been suggested above that is using the actual source code and adding it to your code.

NMilicic commented 6 years ago

I'm sorry but I just can't reproduce the problem. Can anyone make a plunker or repo containing soluting where I can reproduce the error?

salmaarsh06 commented 6 years ago

@NMilicic : ng serve --prod is always success but when we see on view , it shows error Error: No component factory found for PopoverContainerComponent.

NMilicic commented 6 years ago

@salmaarsh06 Can you put that in plunker or repo? I've created a new angular app using angular-cli and I've installed using npm install ngx-bootstrap, bootstrap and ngx-bootstrap-tour. Added some basic steps in the tour and everything seems to be working fine using ng serve --prod and ng serve --aot

salmaarsh06 commented 6 years ago

@NMilicic : ok sure . i will try to create for this .

NMilicic commented 6 years ago

@salmaarsh06 did you manage to reproduce the issue?

basithrehman commented 5 years ago

Any solution for this issue?