You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Components sourcemap not resolved when using sub-paths #59729
Which @angular/* package(s) are the source of the bug?
Don't known / other
Is this a regression?
Yes
Description
While using Angular SSR, the dev server is trying to fetch .component.css.map file from an API server instead of Angular server, resulting in 404 error and crashes Node JS server.
This issue occurs when you add custom styles to a component's stylesheet while also having HTTP client enabled. I have included a demo project that has two components - an Index component and a TodoDetail component. A simple CSS styling is included in the index.component.css file. The TodoDetail component makes a HTTP request to an external API using HttpClient service. While on the TodoDetail page, refresh the browser and clear browser cache, then return back to index page by clicking on the back button on the browser, depending whether you have provideExperimentalZonelessChangeDetection enabled or not, your dev node js SSR server should either crash or show HttpErrorResponse containing 404 Not Found error.
This issue can be simply reproduced by adding a style in todo-detail.component.scss and navigating to http://localhost:4200/todo/12.
The root cause is that the source map request is being accessed relative to http://localhost:4200/todo, resulting in a request for http://localhost:4200/todo/todo-detail.component.css.map. This, in turn, causes the server to interpret it as matching the route todo/:id.
changed the title [-]Dev server crashes if a component stylesheet contains values while the HTTP client is also enabled[/-][+]Components sourcemap not resolved when using sub-paths[/+]on Jan 24, 2025
Activity
alan-agius4 commentedon Jan 24, 2025
This issue can be simply reproduced by adding a style in
todo-detail.component.scssand navigating tohttp://localhost:4200/todo/12.The root cause is that the source map request is being accessed relative to
http://localhost:4200/todo, resulting in a request forhttp://localhost:4200/todo/todo-detail.component.css.map. This, in turn, causes the server to interpret it as matching the routetodo/:id.[-]Dev server crashes if a component stylesheet contains values while the HTTP client is also enabled[/-][+]Components sourcemap not resolved when using sub-paths[/+]fix(platform-browser): prepend `baseHref` to `sourceMappingURL` in CS…
fix(platform-browser): prepend `baseHref` to `sourceMappingURL` in CS…
fix(platform-browser): prepend `baseHref` to `sourceMappingURL` in CS…
angular-automatic-lock-bot commentedon Mar 1, 2025
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.