Description
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
Angular CLI messes up proxy.conf.js regex proxy -settings passed to Vite when using esbuild.
^\\/(?!hui).*
becomes \^\/(?!hui)\.[^/]*?\/?
Minimal Reproduction
Vite doesn't seem to support glob patterns in proxy.conf.js. It supports regular expressions which would do fine but Angular CLI proxy configuration normalization messes up regular expressions. Normalization is done here:
This step perhaps mistakenly treats regular expressions as globs:
// TODO: Consider upstreaming glob support
for (const key of Object.keys(normalizedProxy)) {
if (isDynamicPattern(key)) {
const { output } = parseGlob(key);
normalizedProxy[`^${output}$`] = normalizedProxy[key];
delete normalizedProxy[key];
}
}
Previously with @angular-devkit/build-angular:browser we had:
module.exports = [
{
context: "/internal-api",
target: "http://localhost:8082",
logLevel: "debug",
secure: false
},
{
context: "!/hui/**",
target: "http://localhost:8080",
logLevel: "debug",
secure: false
}
]
With @angular-devkit/build-angular:browser-esbuild something like this should be equivalent if the configuration would go to Vite without changes:
module.exports = {
"/internal-api": {
target: "http://localhost:8082",
secure: false,
},
"^\\/(?!hui).*": {
target: "http://localhost:8080",
secure: false
},
"^\\/$": {
target: "http://localhost:8080",
secure: false,
}
};
Exception or Error
No response
Your Environment
Angular CLI: 17.1.0
Node: 20.11.0
Package Manager: npm 10.2.4
OS: win32 x64
Angular: 17.1.0
... animations, cdk, cli, common, compiler, compiler-cli, core
... forms, language-service, material, material-moment-adapter
... platform-browser, platform-browser-dynamic, router
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1701.0
@angular-devkit/build-angular 17.1.0
@angular-devkit/core 17.1.0
@angular-devkit/schematics 17.1.0
@schematics/angular 17.1.0
ng-packagr 17.1.1
rxjs 7.8.1
typescript 5.3.3
zone.js 0.14.3
Anything else relevant?
No response