nrwl / nx

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

@nrwl/node: showCircularDependencies false still show WARNING after upgrading typescript version to >= 3.5 #1649

Closed xmlking closed 4 years ago

xmlking commented 5 years ago

Please make sure you have read the submission guidelines before posting an issue

Prerequisites

Please answer the following questions for yourself before submitting an issue. YOU MAY DELETE THE PREREQUISITES SECTION.

Expected Behavior

showCircularDependencies:false should disable Circular Dependency warning

Current Behavior

showCircularDependencies:false still showing Circular Dependency warnings

Steps to Reproduce

Please provide detailed steps for reproducing the issue.

  1. sample project https://github.com/xmlking/ngx-starter-kit
  2. ng serve api

Context

Please provide any relevant information about your setup:

Angular CLI: 8.2.0-next.1
Node: 12.6.0
OS: darwin x64
Angular: 8.2.0-rc.0
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router, service-worker

 nx 8.4.0

Failure Logs

ng serve api
Starting type checking service...
Using 14 workers with 2048MB memory limit
Version: typescript 3.5.3
Time: 8039ms
Hash: fee1cdba394376a1fffb
Built at: 07/28/2019 11:23:43 AM
Entrypoint main [big] = main.js main.js.map
chunk {main} main.js, main.js.map (main) 270 KiB [entry] [rendered]

WARNING in Circular dependency detected:
apps/api/src/app/core/core.module.ts -> apps/api/src/app/user/index.ts -> apps/api/src/app/user/user.module.ts -> apps/api/src/app/user/profile/profile.controller.ts -> apps/api/src/app/core/index.ts -> apps/api/src/app/core/core.module.ts

WARNING in Circular dependency detected:
apps/api/src/app/core/entities/audit-base.ts -> apps/api/src/app/user/index.ts -> apps/api/src/app/user/user.module.ts -> apps/api/src/app/user/profile/profile.controller.ts -> apps/api/src/app/core/index.ts -> apps/api/src/app/core/core.module.ts -> apps/api/src/app/project/project.entity.ts -> apps/api/src/app/core/entities/audit-base.ts
johannesschobel commented 5 years ago

I'm running into the same issues with another project. It was initially built with nrwl/nx 8.2 and i just updated to 8.4. This update now breaks my application..

vsavkin commented 5 years ago

@xmlking I tried to repro it but was not able to (https://github.com/nrwl/bug-repro-circular)

Could you try to create a repro from scratch?

xmlking commented 5 years ago

Will do, thanks @vsavkin

mehrad-rafigh commented 5 years ago

@johannesschobel @xmlking Can anyone of you provide a repo where the bug could be reproduced?

johannesschobel commented 5 years ago

Dear @mehrad-rafigh , i will try to create a small showcase repo on monday.. just created a reminder for me ;)

xmlking commented 5 years ago

@vsavkin after upgrading typescript version to 3.5 or 3.6, I can reproduce above issue.

ng serve api   
Starting type checking service...
Using 14 workers with 2048MB memory limit
Type checking in progress...
Hash: c68cab3a482d58c51b48
Built at: 08/31/2019 11:20:51 AM
Entrypoint main = main.js main.js.map
chunk {main} main.js, main.js.map (main) 2.39 KiB [entry] [rendered]

WARNING in Circular dependency detected:
apps/api/src/app/app.controller.ts -> apps/api/src/app/app.service.ts -> apps/api/src/app/app.controller.ts

WARNING in Circular dependency detected:
apps/api/src/app/app.service.ts -> apps/api/src/app/app.controller.ts -> apps/api/src/app/app.service.ts
Debugger listening on ws://localhost:7777/daa8518e-dd8d-434e-bd73-9a9ce7bcb550
Debugger listening on ws://localhost:7777/daa8518e-dd8d-434e-bd73-9a9ce7bcb550
For help, see: https://nodejs.org/en/docs/inspector
[Nest] 16728   - 08/31/2019, 11:20:51 AM   [NestFactory] Starting Nest application...
[Nest] 16728   - 08/31/2019, 11:20:51 AM   [InstanceLoader] AppModule dependencies initialized +20ms
[Nest] 16728   - 08/31/2019, 11:20:51 AM   [RoutesResolver] AppController {/api/}: +19ms
[Nest] 16728   - 08/31/2019, 11:20:52 AM   [RouterExplorer] Mapped {/hello, GET} route +4ms
[Nest] 16728   - 08/31/2019, 11:20:52 AM   [NestApplication] Nest application successfully started +3ms
Listening at http://localhost:3333/api
No type errors found
Version: typescript 3.6.2
Time: 2738ms

this is my updated package.json

{
  "name": "circular",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "nx": "nx",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "nx workspace-lint && ng lint",
    "e2e": "ng e2e",
    "affected:apps": "nx affected:apps",
    "affected:libs": "nx affected:libs",
    "affected:build": "nx affected:build",
    "affected:e2e": "nx affected:e2e",
    "affected:test": "nx affected:test",
    "affected:lint": "nx affected:lint",
    "affected:dep-graph": "nx affected:dep-graph",
    "affected": "nx affected",
    "format": "nx format:write",
    "format:write": "nx format:write",
    "format:check": "nx format:check",
    "update": "ng update @nrwl/workspace",
    "update:check": "ng update",
    "workspace-schematic": "nx workspace-schematic",
    "dep-graph": "nx dep-graph",
    "help": "nx help"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^8.2.4",
    "@angular/common": "^8.2.4",
    "@angular/compiler": "^8.2.4",
    "@angular/core": "^8.2.4",
    "@angular/forms": "^8.2.4",
    "@angular/platform-browser": "^8.2.4",
    "@angular/platform-browser-dynamic": "^8.2.4",
    "@angular/router": "^8.2.4",
    "@nestjs/common": "^6.6.3",
    "@nestjs/core": "^6.6.3",
    "@nestjs/platform-express": "^6.6.3",
    "@nrwl/angular": "8.4.13",
    "core-js": "^3.2.1",
    "reflect-metadata": "^0.1.12",
    "rxjs": "~6.5.2",
    "zone.js": "^0.10.2"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^0.803.2",
    "@angular/cli": "8.3.2",
    "@angular/compiler-cli": "^8.2.4",
    "@angular/language-service": "^8.2.4",
    "@nestjs/schematics": "^6.4.3",
    "@nestjs/testing": "^6.6.3",
    "@nrwl/cypress": "8.4.13",
    "@nrwl/jest": "8.4.13",
    "@nrwl/nest": "8.4.13",
    "@nrwl/node": "8.4.13",
    "@nrwl/workspace": "8.4.13",
    "@types/jest": "24.0.18",
    "@types/node": "~12.7.3",
    "codelyzer": "~5.1.0",
    "cypress": "3.4.1",
    "dotenv": "8.1.0",
    "jest": "24.9.0",
    "jest-preset-angular": "7.1.1",
    "prettier": "1.18.2",
    "ts-jest": "24.0.2",
    "ts-node": "~8.3.0",
    "tslint": "~5.19.0",
    "typescript": "~3.6.2"
  }
}
mehrad-rafigh commented 5 years ago

Hi @xmlking. Can I test it in your nx starter project or do you have another repo, where I could take a look at it?

xmlking commented 5 years ago

@mehrad-rafigh you can test at https://github.com/nrwl/bug-repro-circular

johannesschobel commented 5 years ago

@mehrad-rafigh do you still need a reproduction repository? because if so, i would create some..

mehrad-rafigh commented 5 years ago

@johannesschobel Hi, @xmlking pointed out, that he already had provided a repro where I should be able to recreate the issue. https://github.com/nrwl/bug-repro-circular

I will take a look at this, some time in the next week.

johannesschobel commented 5 years ago

@mehrad-rafigh , yeah i saw this repo as well - however, @vsavkin was not able to recreate it. Maybe you have more luck, haha ;) If you require any additional info / help, i am glad to provide another repo

xmlking commented 5 years ago

please note: you have to use typescript version 3.5 or above to reproduce this issue. typescript v3.4 works fine.

vsavkin commented 5 years ago

Folks, I tried different version of typescript here (https://github.com/nrwl/bug-repro-circular)--no luck. I mean it works :)

xmlking commented 5 years ago

@vsavkin could you replace your package.json with the content I provided above into https://github.com/nrwl/bug-repro-circular and try ? i remember able to reproduce this issue

vsavkin commented 5 years ago

@xmlking I tried https://github.com/nrwl/bug-repro-circular . It works.

xmlking commented 5 years ago

I don’t install typescript globally, solely using project specific typescript version . May be this issue is specific to my setup. You can close this issue. Thanks

johannesschobel commented 5 years ago

Dear @vsavkin and @xmlking , i was able to reproduce this issue in my own setup (nestjs only application). If you like i can provide a small reproduction repository?

demisx commented 4 years ago

This showCircularDependencies build option works for me in v8.8.3. No issues.

johannesschobel commented 4 years ago

@demisx where did you put this showCircularDependencies flag?

demisx commented 4 years ago

In the angular.json's project:

{
  "version": 1,
  "projects": {
    "api": {
       "root": "apps/api",
       "sourceRoot": "apps/api/src",
       "projectType": "application",
       "prefix": "api",
       "schematics": {},
       "architect": {
         "build": {
           "builder": "@nrwl/node:build",
           "options": {
             ...
             "showCircularDependencies": false
           },
...
johannesschobel commented 4 years ago

Thanks. I will try this tomorrow and give proper feedback on this possible solution

vsavkin commented 4 years ago

@johannesschobel Hi there! Any update?

xmlking commented 4 years ago

@vsavkin I have showCircularDependencies: false here https://github.com/xmlking/ngx-starter-kit/blob/develop/angular.json#L94 But still get WARNING in Circular dependency detected

ng serve api
Starting type checking service...
Using 14 workers with 2048MB memory limit
Type checking in progress...
Hash: a4e4e241def135865a1b
Built at: 02/22/2020 12:54:57 PM
Entrypoint main [big] = main.js main.js.map
chunk {main} main.js, main.js.map (main) 243 KiB [entry] [rendered]

WARNING in Circular dependency detected:
apps/api/src/app/core/core.module.ts -> apps/api/src/app/user/index.ts -> apps/api/src/app/user/user.module.ts -> apps/api/src/app/user/profile/profile.controller.ts -> apps/api/src/app/core/index.ts -> apps/api/src/app/core/core.module.ts

WARNING in Circular dependency detected:
apps/api/src/app/core/entities/audit-base.ts -> apps/api/src/app/user/index.ts -> apps/api/src/app/user/user.module.ts -> apps/api/src/app/user/profile/profile.controller.ts -> apps/api/src/app/core/index.ts -> apps/api/src/app/core/core.module.ts -> apps/api/src/app/project/project.entity.ts -> apps/api/src/app/core/entities/audit-base.ts

WARNING in Circular dependency detected:
apps/api/src/app/core/index.ts -> apps/api/src/app/core/core.module.ts -> apps/api/src/app/user/index.ts -> apps/api/src/app/user/user.module.ts -> apps/api/src/app/user/profile/profile.controller.ts -> apps/api/src/app/core/index.ts

WARNING in Circular dependency detected:
apps/api/src/app/project/cluster/cluster.entity.ts -> apps/api/src/app/core/entities/audit-base.ts -> apps/api/src/app/user/index.ts -> apps/api/src/app/user/user.module.ts -> apps/api/src/app/user/profile/profile.controller.ts -> apps/api/src/app/core/index.ts -> apps/api/src/app/core/core.module.ts -> apps/api/src/app/project/project.entity.ts -> apps/api/src/app/project/cluster/cluster.entity.ts
...
johannesschobel commented 4 years ago

Dear @vsavkin , i am sorry that i did not properly reply on the latest questions / feedback posted in this issue. However, i did try the showCircularDependencies : true in my NestJS application without any luck!

Those are only warnings (as described by @xmlking ), build successfully passes and application works as expected. Nevertheless, it's quite annoying 😆

All the best, Johannes

johannesschobel commented 4 years ago

i can confirm, that this works now in the @nrwl/nx:latest version (9.0.4)

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.