Nx: generating a lazy loaded lib throws "Cannot read property 'toString' of null"

Created on 2 Feb 2018  路  3Comments  路  Source: nrwl/nx

I am trying to generate a lib (module) that will be lazy loaded to my apps. Here is what I do on the command line:
ng generate lib admin --routing --lazy --parentModule=apps/myapp/src/myapp.module.ts
I get the following error and no files are created:
ngmodule

Here seems to be some issue when parent module is provided. If I run the following:
ng generate lib admin --routing I can successfully create the module but again without the seperated routing module file.

Most helpful comment

The issue is that the parentModule path is incorrect (it should be apps/myapp/src/app/myapp.module.ts). We should provide a better error message though.

All 3 comments

anyone has sorted this out? I'm having the same issues

I think i saw the same issue when I have dependencies updated. For me, I created a brand new nx-work-space, and then copied the default dependencies and devDependencies into my project, replacing any updated dependencies.

I now have to be extra careful when updating dependencies...

The issue is that the parentModule path is incorrect (it should be apps/myapp/src/app/myapp.module.ts). We should provide a better error message though.

Was this page helpful?
0 / 5 - 0 ratings