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

Esbuild builder - support TypeScript path mappings #24654

Closed
1 task
JanST123 opened this issue Feb 3, 2023 · 3 comments · Fixed by #24746
Closed
1 task

Esbuild builder - support TypeScript path mappings #24654

JanST123 opened this issue Feb 3, 2023 · 3 comments · Fixed by #24746
Labels
angular/build:application area: @angular-devkit/build-angular feature: in backlog Feature request for which voting has completed and is now in the backlog feature Issue that requests a new feature

Comments

@JanST123
Copy link

JanST123 commented Feb 3, 2023

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

No response

Description

As the experimental esbuild does not yet support features like respecting the paths from tsconfig.json that lack of features can be workarounded by custom esbuild plugins (esbuild-ts-paths in the case of the missing paths transforming).

But plugins can't be passed to the esbuild.build function yet.

Describe the solution you'd like

Pass another option plugins to esbuild.build like it was done for the external option in #23322

Minimal Reproduction

  • Have paths defined in tsconfig.json
  "compilerOptions": {
    "paths": {
      "@shared/*": [
        "src/app/@shared/*"
      ]
    }
  }
  • Notice that the compiler can't find the modules imported from that paths
import { MySharedModuled } from '@shared/shared.module';

Exception or Error

No response

Your Environment

Angular CLI: 15.1.4
Node: 14.21.2
Package Manager: npm 6.14.17
OS: darwin x64

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

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1501.4
@angular-devkit/build-angular   15.1.4
@angular-devkit/core            15.1.4
@angular-devkit/schematics      15.1.4
@angular/cli                    15.1.4
@schematics/angular             15.1.4
ng-packagr                      15.1.1
rxjs                            7.8.0
typescript                      4.9.5

Anything else relevant?

No response

@alan-agius4 alan-agius4 changed the title support for providing esbuild plugins option Esbuild builder - support TypeScript path mappings Feb 3, 2023
@alan-agius4
Copy link
Collaborator

There are two parts in this issue:

@alan-agius4 alan-agius4 added feature Issue that requests a new feature area: @angular-devkit/build-angular feature: in backlog Feature request for which voting has completed and is now in the backlog angular/build:application labels Feb 3, 2023
@thaoula
Copy link

thaoula commented Feb 16, 2023

Hi @alan-agius4,

I recently tried to build our app using 15.2.0-next.4 because it included the .less support.

I was able to build without any errors but was not able to run due to errors in code at run time (the inherited class was undefined).

I was going to raise a bug and saw this issue. We have a similar setup where we use typescript paths so our imports @brand/xxxx ... We also have a model folder in with the @brand path that is symlinked to allow sharing with the API.

Would not having path support result in build errors or no errors at build time just runtime errors?

Regards,
Tarek

@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 Mar 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
angular/build:application area: @angular-devkit/build-angular feature: in backlog Feature request for which voting has completed and is now in the backlog feature Issue that requests a new feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants