0

I have a angular application in version 10. It is built using workspace which consists of a library and a application. I have installed following dependencies in the angular application.

npm install @ngrx/store
npm install @ngrx/store-devtools
npm install @ngrx/schematics
npm install @ngrx/effects

Below is the code in the package.json (dependencies in angular application)

{
 ...
     @ngrx/component-store: '^11.0.1',
     @ngrx/effects : '^11.0.1'
     @ngrx/store: '^11.0.1'
     @ngrx/store-devtools: '^11.0.1'
 ...

}

(dev dependency) 
{
....
   @ngrx/schematics: '^11.0.1'
....

}

Below is the code in the package.json ( peer dependency in library)

{
 ...
     @ngrx/component-store: '^11.0.1',
     @ngrx/effects : '^11.0.1'
     @ngrx/store: '^11.0.1'
     @ngrx/store-devtools: '^11.0.1'
 ...

}

Now i am try to create a store state inside the library using the below commands

ng g store customerState --statePath=projects/customer/src/lib/store/reducers --module=projects/customer/src/lib/customer.module.ts

I get the below error after the above command

An unhandled exception occured: schematic 'store' not found in collection @schematics/angular'

Any help to resolve the issues

  • Checkout this https://stackoverflow.com/questions/62725724/schematic-store-not-found-in-collection-schematics-angular – hbamithkumara Mar 10 '21 at 04:37
  • this does not help. as said schematics is already in the application. Now i am trying to create a store in the library not in the application – jai angular Mar 10 '21 at 05:54
  • after a few analysis i learnt that we cannot use boiler plate commands of ngrx store in the library. it works well in the application but not in the library. However as an alternative we can create manually files in the angular library. – jai angular Mar 12 '21 at 10:01

1 Answers1

0

after analysis, i learnt that we do not have any options to use ngrx boiler plate commands inside the angular library. As an alternative we can manually create the ngrx files manually in the library.