Angular 17: dev-server with esbuild rewrites hrefs in index.html #27795
Labels
area: angular/build
devkit/build-angular:dev-server
freq1: low
Only reported by a handful of users who observe it rarely
severity3: broken
type: bug/fix
Command
build
Is this a regression?
The previous version in which this bug was not present was
Angular 17 with webpack
Description
I use several angular apps and microfrontends and have proxy that routes each url to a different microfrontend.
With Angular 17 this does not work anymore, because the href entries in the index.html seem to be modified by the vite server.
I am using the following configuration of my dev-server in angular.json:
In my index.html iinject a script which comes from a different microfrontend using an absolute path:
<script src="/microfrontend2/shared-components.js" defer></script>
The vite server renders this tag as
<script src="/microfrontend1/microfrontend2/shared-components.js" defer></script>
Vite seems to always append the servePath value to all hrefs, not regarding if they are relative or absolute.
There seems to be no possible option to disable this messing around with urls.
Minimal Reproduction
Setup new Angular 17 Project
Use esbuild
Add a <script /> tag with an absolute href to the index.html
Exception or Error
No response
Your Environment
Anything else relevant?
No response
The text was updated successfully, but these errors were encountered: