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

(bug) Angular workspace multiple tsconfig.json files with invalid names. #15662

Closed
Domvel opened this issue Sep 24, 2019 · 2 comments
Closed

Comments

@Domvel
Copy link

Domvel commented Sep 24, 2019

🐞 Bug report

It's more a problem rather than a bug.

Command

- [x] new
- [ ] build
- [ ] serve
- [ ] test
- [ ] e2e
- [x] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc

Is this a regression?

Since workspaces exists with the special tsconfig.json name. Keep reading...

Description

An Angular workspace (see docs) creates projects with one tsconfig.json file in the root and more tsconfig.json files for each project which extends the root config json. That's ok. But the names of the tsconfig files in the projects are not valid names to work with e.g. vscode.

In a project there are two tsconfig files.

  • tsconfig.spec.json
  • tsconfig.app.json

The problem is that the IDE (or other tools) can't detect this file, because of the special name.
The valid name should be tsconfig.json like the root file.

For example:
If you add an exclude in the tsconfig.app.json to exclude other apps in the project folder except itself and the shared-lib, it will not work for e.g. the auto import of vscode. Because the tsconfig.app.json is not load. If I rename it to tsconfig.json it works.
Background: In my case I do not want to get suggestions about imports of other apps in the project folder. Only fromthe shared-folder. This should be a default configuration of Angular workspace, but it's another issue.

🔬 Minimal Reproduction

Just greate a worksapce.

ng new my-workspace --createApplication="false"
ng generate application app1
ng generate application app2

or simple greate a project without angular to see the problem.

auto-import-issue
|= projects
|  |= app1
|  |  |- main.ts
|  |  |- page.ts
|  |  \- tsconfig.app.json
|  \= app2
|     |- main.ts
|     |- page.ts
|     \- tsconfig.app.json
\- tsconfig.json

🌍 Your Environment


Angular CLI: 8.3.5
Node: 10.15.3
OS: win32 x64
Angular: 8.2.7
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                            Version
------------------------------------------------------------
@angular-devkit/architect          0.801.3
@angular-devkit/build-angular      0.803.5
@angular-devkit/build-ng-packagr   0.803.5
@angular-devkit/build-optimizer    0.803.5
@angular-devkit/build-webpack      0.803.5
@angular-devkit/core               8.1.3
@angular-devkit/schematics         8.1.3
@angular/cli                       8.3.5
@ngtools/webpack                   8.3.5
@schematics/angular                8.3.5
@schematics/update                 0.803.5
ng-packagr                         5.5.1
rxjs                               6.4.0
typescript                         3.5.3
webpack                            4.39.2

Other informations

Maybe the enviroment like vscode or typescript should wildcard the tsconfig.*.json.
But in this case we have two tsconfig.json files in a project. For spec and app. This is a conflict.
The IDE (vscode) should grab the angular.json? You can't expect it. But the Angular team could request it. ... I'm not sure If I understood the intention of the Angular team about these tsconfig files. Maybe it is intended that the tsconfig files are invalid names to prevent loading from other tools like vscode and only Angular should handle it.

I need the tsconfig sometimes for declaring paths. But at this moment I just want to ignore all other apps in the project folder to prevent auto import etc. from other projects but the shared-lib folder.

@alan-agius4 alan-agius4 added the needs: discussion On the agenda for team meeting to determine next steps label Sep 24, 2019
@filipesilva
Copy link
Contributor

Heya, this is actually a dupe of an older issue: #8138.
I've added a comprehensive answer in #8138 (comment).

@filipesilva filipesilva removed the needs: discussion On the agenda for team meeting to determine next steps label Sep 26, 2019
@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 Oct 27, 2019
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

3 participants