question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Angular 9 Upgrade updates to tsconfig.app.json are undocumented.

See original GitHub issue

📚 Docs or angular.io bug report

Description

The Angular 9 upgrade updated the tsconfig.app.json and tsconfig-es5.app.json as follows (the project uses the differential loading workaround from the angular 8 upgrade to allow ng serve to support IE):

tsconfig.app.json
Old:
{
  "extends": "../tsconfig.json",
  "compilerOptions": {
    "outDir": "../out-tsc/app",
    "types": []
  },
  "exclude": [
    "src/test.ts",
    "**/*.spec.ts"
  ]
}
New:
{
  "extends": "../tsconfig.json",
  "compilerOptions": {
    "outDir": "../out-tsc/app",
    "types": []
  },
  "files": [
    "main.ts",
    "polyfills.ts"
  ],
  "include": [
    "src/**/*.d.ts"
  ]
}

(i.e.) ‘exclude’ was removed and ‘files’ and ‘include’ were added.

tsconfig-es5.app.json
Old:
{
    "extends": "./tsconfig.app.json",
    "compilerOptions": {
        "target": "es5"
     }
}
New:
{
    "extends": "./tsconfig.app.json",
    "compilerOptions": {
        "target": "es5"
     }
   ,  "include": [
    "src/**/*.d.ts"
  ]
}

Checking the tsconfig.app.json for a default CLI Angular 8 project upgraded to 9 the file is:

{
  "extends": "./tsconfig.json",
  "compilerOptions": {
    "outDir": "./out-tsc/app",
    "types": []
  },
  "files": [
    "src/main.ts",
    "src/polyfills.ts"
  ],
  "include": [
    "src/**/*.ts"
  ],
  "exclude": [
    "src/test.ts",
    "src/**/*.spec.ts"
  ]
}

This seems to be the only information about this in the upgrade documentation: We have updated the tsconfig.app.json to limit the files compiled. If you rely on other files being included in the compilation, such as a typings.d.ts file, you need to manually add it to the compilation.

I think the addition of the include statement may be related to: https://github.com/angular/angular-cli/issues/16923.

And the addition of files may be related to: https://github.com/angular/angular-cli/issues/17066

Why were these changes made? Why was the ‘exclude’ statement removed? Why are the changes different for the es5 file?

Please update the upgrade documentation to include information about why these the upgrader is makes these changes.

What’s the affected URL?**

https://update.angular.io/#8.0:9.0l3 https://angular.io/guide/updating-to-version-9

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
tdkehoecommented, Oct 27, 2020

What does the “d” mean in “src/**/*.d.ts”? It includes files that don’t have a “d” and excludes other files. And what’s the difference between “files” and “include”? Which files or paths go where?

1reaction
roopeshreddycommented, Aug 17, 2020

I referred this question on Enterprise slack group and @mgechev confirmed me my assumption was correct! As @devin5885 explained, we may need to explicitly include the additional files to be compiled.

IMO this change is for simplification, but unfortunately, it’s not documented anywhere!

I just shared this information, so that, if anyone is looking for this, it may be helpful!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular 9 tsconfig.json & tsconfig.app.json paths are not ...
The issue is that in each app, the @libs path always throws Cannot find module '@libs/cool-module.module' . The other paths in the tsconfig.app....
Read more >
TypeScript configuration - Angular
A given Angular workspace contains several TypeScript configuration files. At the root tsconfig.json file specifies the base TypeScript and Angular compiler ...
Read more >
Building Full-Stack React Applications in a Monorepo - Nx Blog
In this post we will look at how we can build multiple React applications, in… ... nx.json package.json tsconfig.json. Let's update api/src/main.ts to ......
Read more >
nrwl-nx/community - Gitter
When I started to fiddle around with tsconfig and tried to change it to what I had for Angular 9 it start to...
Read more >
Documentation - What is a tsconfig.json - TypeScript
The presence of a tsconfig.json file in a directory indicates that the directory is the root of a TypeScript project. The tsconfig.json file...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found