Skip to content

esbuild dev server proxy doesn't rewrite path #25562

@shyallegro

Description

@shyallegro

Command

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

from the info I managed to collect esbuild uses vite as a dev server.
however path rewrite is done differently and require a rewrite function see
my guess, pathRewrite need to be converted to rewrite function here

Minimal Reproduction

in angular.json enable esbuild
add a proxy file proxy.config.json:

{
  "/api": {
    "target": "http://npmjs.org",
    "secure": false,
    "pathRewrite": {
      "^/api": ""
    },
    "changeOrigin": true
  }
}

and run
ng serve --proxy-config proxy.config.json

Exception or Error

No response

Your Environment

Angular CLI: 16.1.4
Node: 18.16.1
Package Manager: npm 9.5.1
OS: win32 x64

Angular: 16.1.5
... animations, cdk, common, compiler, compiler-cli, core, forms
... language-service, material, platform-browser
... platform-browser-dynamic, platform-server, router
... service-worker, youtube-player

Package                          Version
----------------------------------------------------------
@angular-devkit/architect        0.1601.4
@angular-devkit/build-angular    16.1.4
@angular-devkit/core             16.1.4
@angular-devkit/schematics       16.1.4
@angular-devkit/schematics-cli   16.1.4
@angular/cli                     16.1.4
@schematics/angular              16.1.4
rxjs                             7.8.1
typescript                       5.1.6

Anything else relevant?

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions