Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

360
Views
How to avoid calling StoreModule.forRoot() twice when using ngrx in a library

I am creating an angular library that uses ngrx. For the library I have just a couple Feature reducers that I can initialize easy enough in the library base module. The problem is that I don't know whether or not to call StoreModule.forRoot(...) in the library base module. Some consumers of the library already use ngrx so if I do it will break as it gets called twice however some consumers are not using it so it will break if I don't include it. I could require all consumers who do not already use ngrx to include StoreModule.forRoot([]) in their base module imports but I would like to avoid this. Is there a way to conditionally initialize the store module from the library to avoid these errors?

over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!