Skip to content

Angular 16 ESbuild not recoginzing main.ts and polyfills.ts files even after including in tsconfig.app.json #27189

@SandeepCheemakurthi

Description

@SandeepCheemakurthi

Command

build, config, serve

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

trying to serve the application with forceEsbuild option, but after running the ng serve, throwing error. Also application works fine and there is no problem in serving the application without forceEsbuild option. Tried with node v16 and v18, but no luck.

Using the below dependency versions
"@angular-devkit/build-angular": "16.2.12",
"@angular/common": "^16.2.8",
"@angular/compiler": "^16.2.8",
"@angular/core": "^16.2.8",

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

X [ERROR] File 'src\main.ts' is missing from the TypeScript compilation. [plugin angular-compiler]

Ensure the file is part of the TypeScript program via the 'files' or 'include' property.

X [ERROR] File 'src\polyfills.ts' is missing from the TypeScript compilation. [plugin angular-compiler]

angular:polyfills:angular:polyfills:1:7:
  1 │ import 'src/polyfills.ts';

Minimal Reproduction

ng serve

Exception or Error

No response

Your Environment

Angular CLI: 16.2.12
Node: 16.15.0
Package Manager: npm 8.5.5
OS: win32 x64

Angular: 16.2.12
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                            Version
------------------------------------------------------------    
@angular-devkit/architect          0.1602.12
@angular-devkit/build-angular      16.2.12
@angular-devkit/build-ng-packagr   0.1002.0
@angular-devkit/core               16.2.12
@angular-devkit/schematics         16.2.12
@angular/cdk                       16.2.13
@angular/material                  16.2.13
@schematics/angular                16.2.12
ng-packagr                         16.2.3
rxjs                               7.8.1
typescript                         4.9.5
zone.js                            0.14.3

Anything else relevant?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions