nrwl / nx

Smart Monorepos · Fast CI
https://nx.dev
MIT License
22.73k stars 2.27k forks source link

Lazy loaded lib not added to tsconfig(s) include. #310

Closed ph55 closed 4 years ago

ph55 commented 6 years ago

If lib added as --lazy and --parent-module specified as lib and not as app - no changes to tsconfig.app.json and tsconfig.e2e.json would be written.

Include should be added. Otherwise error thrown on serve:

ERROR in ./libs/crm-ui/user/index.ts
Module build failed: Error: C:\Users\alex\Documents\_dev\nx-test\libs\crm-ui\user\index.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
    at AngularCompilerPlugin.getCompiledFile (C:\Users\alex\Documents\_dev\nx-test\node_modules\@ngtools\webpack\src\angular_compiler_plugin.js:674:23)
    at plugin.done.then (C:\Users\alex\Documents\_dev\nx-test\node_modules\@ngtools\webpack\src\loader.js:467:39)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)

Steps to reproduce:

Error fixed by manually adding following line to tsconfig.app.json include:

"../../../libs/crm-ui/user/index.ts",
FrozenPandaz commented 6 years ago

Hi all,

I'm relabeling this as an enhancement instead of a bug. We do not yet incorporate multi-level dependency information into the generation of libs. So I am just labeling this as an enhancement to differentiate between providing new functionality and fixing existing functionality.

ThomasBurleson commented 6 years ago

Related to #528

xmlking commented 5 years ago

Nothing created with following command.

ng g lib grid1  --routing --lazy --prefix=ngx --parent-module=libs/dashboard/src/lib/dashboard.module.ts   --tags=child-module

Sample app to reproduce: https://github.com/xmlking/ngx-starter-kit

Env:

"@nrwl/schematics": "^6.2.0",

Angular CLI: 6.1.2
Node: 10.7.0
OS: darwin x64
Angular: 6.1.1
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router, service-worker

Package                            Version
------------------------------------------------------------
@angular-devkit/architect          0.7.2
@angular-devkit/build-angular      0.7.2
@angular-devkit/build-ng-packagr   0.7.2
@angular-devkit/build-optimizer    0.7.2
@angular-devkit/build-webpack      0.7.2
@angular-devkit/core               0.7.2
@angular-devkit/schematics         0.7.2
@angular/cdk                       6.4.3
@angular/cdk-experimental          6.4.3
@angular/cli                       6.1.2
@angular/flex-layout               6.0.0-beta.17
@angular/material                  6.4.3
@angular/material-moment-adapter   6.4.3
@angular/pwa                       0.7.2
@ngtools/json-schema               1.1.0
@ngtools/webpack                   6.1.2
@schematics/angular                0.7.2
@schematics/update                 0.7.2
ng-packagr                         4.0.1
rxjs                               6.2.2
typescript                         2.9.2
xmlking commented 5 years ago

looks like above issue happens when we upgrade "@angular-devkit/build-angular": "^0.7.2", if we rollback to ~~ ~~ "@angular-devkit/build-angular": "^0.6.8" routing/lazy works.

actually the issue is with typescript 2.9.2. after downgrading to 2.7.2 it looks like working !

vsavkin commented 4 years ago

Folks. I'm going to close this issue. The new loadChildren syntax doesn't require you to update tsconfig files.

github-actions[bot] commented 1 year ago

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.