Skip to content

Add 'provideHttpClient(withFetch)' for new SSR projects #65583

@geromegrignon

Description

@geromegrignon

Command

new

Description

Angular 21 removed the explicit provideHttpClient from the app.config.ts, making its addition only useful if you need to add advanced configuration.

In the Angular documentation reference, I found out withFetch is recommended for SSR apps.

It's strongly recommended to enable [fetch](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) for applications that use Server-Side Rendering for better performance and compatibility. To enable fetch, add [withFetch()](https://angular.dev/api/common/http/withFetch) feature to the

source: https://angular.dev/api/common/http/provideHttpClient#provideHttpClient_0

Describe the solution you'd like

To avoid having people figure it out by landing on this reference page, it would be great to have this configuration by default when the SSR prompt option is chosen on the ng new schematic. Users would get the optimized solution directly.

Describe alternatives you've considered

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions