Skip to content

tsconfig.paths are not taken into account when compiling with ESBuild #27176

@jcompagner

Description

@jcompagner

Command

build

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

with "browser" builder (not application or esbuild)

Description

there are already a few cases but those are closed like:
#26467
and
#26476

tsconfigpaths.zip

But for me its quite easy to reproduce, just extract the attached zip, run "npm install" and then "npm run build" on it and you will get:

✘ [ERROR] File 'internalproject\servoy-public\src\public-api.ts' is missing from the TypeScript compilation. [plugin angular-compiler]

    externalproject/bootstrapcomponents/fesm2022/servoy-bootstrapcomponents.mjs:3:20:
      3 │ import * as i1 from '@servoy/public';
        ╵                     ~~~~~~~~~~~~~~~~

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

but that project is there it is part of the main thing by using a tsconfig mapping:

"paths": {
      "@servoy/public": [
        "./internalproject/servoy-public/src/public-api",
      ]
    },

if i read this:
https://esbuild.github.io/api/#external

then i think if i could just provide that as an external thing that is solved at runtime this could work?
(but i have no idea how to provide that with the angular builder)

So how can we make sure that the esbuilder (or angular/cli) does see those modules because they are there because the are part of the main source and specified as a path?

Minimal Reproduction

unzip the given zip above
npm install
npm run build

Exception or Error

that it compiles fine

Your Environment

Angular CLI: 17.2.1
Node: 20.11.0
Package Manager: npm 10.2.4
OS: win32 x64

Angular: 17.2.3
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1702.1
@angular-devkit/build-angular   17.2.1
@angular-devkit/core            17.2.1
@angular-devkit/schematics      17.2.1
@angular/cli                    17.2.1
@schematics/angular             17.2.1
rxjs                            7.8.1
typescript                      5.3.3
zone.js                         0.14.4

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