question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

shared module issues

See original GitHub issue

I am using ngx-toastr in one of my angular 7 library project, it is been consumed by another host project. The host project works perfectly fine in dev version, but when i create production build(using ng build --prod) it gives me following error:

StaticInjectorError(Platform: core)[InjectionToken ToastConfig]: 
NullInjectorError: No provider for InjectionToken ToastConfig!
Error: StaticInjectorError[InjectionToken ToastConfig]: 
StaticInjectorError(Platform: core)[InjectionToken ToastConfig]: 
NullInjectorError: No provider for InjectionToken ToastConfig!```


I am already importing  **ToastrModule.forRoot()** in my library module, not sure why there's dual behavior for dev and prod environment? 

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:3
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
scttcpercommented, May 11, 2019

there isn’t a way to import toastr from a shared module right now.

0reactions
ajazhmdcommented, Jun 18, 2020

@RoRoche try importing ToastrModule.forRoot() instead ToastrModule in your shared modules.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What is the correct way to deal with shared modules? #543
In studio, go to Windows> preference and make sure you see this entry. If not then add it and restart studio. ... Open...
Read more >
Error trying to use a shared module in Angular 9 make my ...
To avoid this problem you need to Add SharedModule as an import in all the FeatureModules where your components reside as declarations.
Read more >
Sharing modules - Angular
Creating shared modules allows you to organize and streamline your code. You can put commonly used directives, pipes, and components into one module...
Read more >
Shared Module Routing Issue - StackBlitz
Dependencies · 1 · 2 · 3 · 4 · 5 · 6 · 7 · 8.
Read more >
Eliminating Shared Module(s) - Medium
Online research points to a consensus that several Shared modules is now considered best practice, which I immediately took issue with back ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found