Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solution tsconfig not working on library dev or monorepo setup #37781

Closed
JohnnyDevNull opened this issue Jun 26, 2020 · 8 comments
Closed

Solution tsconfig not working on library dev or monorepo setup #37781

JohnnyDevNull opened this issue Jun 26, 2020 · 8 comments

Comments

@JohnnyDevNull
Copy link

JohnnyDevNull commented Jun 26, 2020

🐞 bug report

Affected Package

@angular/cli migration for solution tsconfig

Is this a regression?

Angular 9 just worked fine

Description

When the Angular project is used in workspace mode the tsconfig paths for libraries and local stuff will not work no more, because of the solution tsconfig setup.

🔬 Minimal Reproduction

ng new ng-test --create-application=false --skipInstall --skipGit
ng g library my-test --prefix=mt
ng g library my-test2 --prefix=mt2
ng g application my-tester --routing=true --style=scss
ng build --project=my-test
ng build --project=my-test2

After this setup reload your VSCode oder WebStorm and just try to import the Libraries Modules in the AppModule.

The generated configs from the CLI:

tsconfig.json

/*
  This is a "Solution Style" tsconfig.json file, and is used by editors and TypeScript’s language server to improve development experience.
  It is not intended to be used to perform a compilation.

  To learn more about this file see: https://angular.io/config/solution-tsconfig.
*/
{
  "files": [],
  "references": [
    {
      "path": "./projects/my-test/tsconfig.lib.json"
    },
    {
      "path": "./projects/my-test/tsconfig.spec.json"
    },
    {
      "path": "./projects/my-test2/tsconfig.lib.json"
    },
    {
      "path": "./projects/my-test2/tsconfig.spec.json"
    },
    {
      "path": "./projects/my-tester/tsconfig.app.json"
    },
    {
      "path": "./projects/my-tester/tsconfig.spec.json"
    },
    {
      "path": "./projects/my-tester/e2e/tsconfig.json"
    }
  ]
}

tsconfig.base.ts

{
  "compileOnSave": false,
  "compilerOptions": {
    "baseUrl": "./",
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "downlevelIteration": true,
    "experimentalDecorators": true,
    "moduleResolution": "node",
    "importHelpers": true,
    "target": "es2015",
    "module": "es2020",
    "lib": [
      "es2018",
      "dom"
    ],
    "paths": {
      "my-test": [
        "dist/my-test/my-test",
        "dist/my-test"
      ],
      "my-test2": [
        "dist/my-test2/my-test2",
        "dist/my-test2"
      ]
    }
  }
}

🔥 Exception or Error

All my Editors, VSCode & WebStorm do not recognize the paths and imports no more. Code Completion stoped working, but ng serve or ng build works just fine.

image

image

🌍 Your Environment

Angular Version:


     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 10.0.0
Node: 12.18.0
OS: linux x64

Angular: 10.0.0
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Ivy Workspace: Yes

Package                            Version
------------------------------------------------------------
@angular-devkit/architect          0.1000.0
@angular-devkit/build-angular      0.1000.0
@angular-devkit/build-ng-packagr   0.1000.0
@angular-devkit/build-optimizer    0.1000.0
@angular-devkit/build-webpack      0.1000.0
@angular-devkit/core               10.0.0
@angular-devkit/schematics         10.0.0
@ngtools/webpack                   10.0.0
@schematics/angular                10.0.0
@schematics/update                 0.1000.0
ng-packagr                         10.0.0
rxjs                               6.5.5
typescript                         3.9.5
webpack                            4.43.0

Anything else relevant?

As i can read from the docs this should be a editor improvement, but can't realize whats the improvement then just them stopping to work. Angular names it as a enterprise framework, this is also true for enterprise setups just like libraries for sharing code. Especially in Monorepo setups with multiple apps and just them now not working with this setup.

@JohnnyDevNull JohnnyDevNull changed the title Solution tsconfig not working on library dev Solution tsconfig not working on library dev or monorepo setup Jun 26, 2020
@JoostK
Copy link
Member

JoostK commented Jun 26, 2020

Please try again with 10.0.1, released in the last hour or so.

@JohnnyDevNull
Copy link
Author

Nope still the same... just removing the solution setup back to the old works.

@JoostK
Copy link
Member

JoostK commented Jun 26, 2020

Ah, it requires a release of the LS plugin. Please follow angular/vscode-ng-language-service#824 for updates and relevant comments.

@JoostK JoostK closed this as completed Jun 26, 2020
@kyliau
Copy link
Contributor

kyliau commented Jun 26, 2020

This has been fixed in v0.1000.1 which just got released.
https://github.com/angular/vscode-ng-language-service/releases/tag/v0.1000.1
I'll close this issue for now, please open a new issue if you run into problem with solution-style tsconfig.

@JohnnyDevNull
Copy link
Author

JohnnyDevNull commented Jun 27, 2020

I don't know what you've done, but this is still not working. Wether with VSCode nore with WebStorm.

What i've done:

  • Removed the node_modules folder and package-lock.json, so that a complete reinstall is done
  • Reloaded VSCode and updated the Angular Language Service Plugin
  • Opened the first TS file and waited for initializing

Same picture as above... no library completion and the configured TS-Flags from the tsconfig.base.ts are also missing

@destus90
Copy link
Contributor

I have the same exact problem with ng 10 in most IDEs. I have created an issue in the CLI repo and looking forward to a fix. angular/angular-cli#18040

@alan-agius4
Copy link
Contributor

@destus90, your issue in not related to the Angular LS, but rather to the fact that the file is not being picked up by any LS because it’s not part of any compilation.

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Jul 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants