Skip to content

Conversation

alan-agius4
Copy link
Collaborator

@alan-agius4 alan-agius4 commented Mar 18, 2025

This commit introduces provideServerRendering as the primary function for configuring server-side rendering, replacing provideServerRouting. provideServerRendering now includes the functionality of provideServerRouting through the use of the withRoutes feature.

This change consolidates server-side rendering configuration into a single, more flexible function, aligning with the evolution of Angular SSR.

Before:

import { ApplicationConfig } from '@angular/core';
import { provideServerRouting } from '@angular/ssr';
import { provideServerRendering } from '@angular/platform-server';
import { serverRoutes } from './app.routes';

const serverConfig: ApplicationConfig = {
  providers: [
    provideServerRendering(),
    provideServerRouting(serverRoutes)
  ]
};

After:

import { ApplicationConfig } from '@angular/core';
import { provideServerRendering, withRoutes } from '@angular/ssr';
import { serverRoutes } from './app.routes';

const serverConfig: ApplicationConfig = {
  providers: [
    provideServerRendering(withRoutes(serverRoutes))
  ]
};

@alan-agius4 alan-agius4 added the target: major This PR is targeted for the next major release label Mar 18, 2025
@angular-robot angular-robot bot added detected: feature PR contains a feature commit area: @angular/ssr labels Mar 18, 2025
@alan-agius4 alan-agius4 force-pushed the provide-server-rendering branch 6 times, most recently from baf7477 to 526f7b4 Compare March 18, 2025 12:34
…deServerRouting`

This commit introduces `provideServerRendering` as the primary function for configuring server-side rendering, replacing `provideServerRouting`. `provideServerRendering` now includes the functionality of `provideServerRouting` through the use of the `withRoutes` feature.

This change consolidates server-side rendering configuration into a single, more flexible function, aligning with the evolution of Angular SSR.

**Before:**
```ts
import { provideServerRouting } from '@angular/ssr';
import { serverRoutes } from './app.routes';

provideServerRouting(serverRoutes);
```

**After:**
```ts
import { provideServerRendering, withRoutes } from '@angular/ssr';
import { serverRoutes } from './app.routes';

provideServerRendering(withRoutes(serverRoutes));
```
- Migrate imports of `provideServerRendering` from `@angular/platform-server` to `@angular/ssr`.
- Update `provideServerRendering` to use `withRoutes` and remove `provideServerRouting` from `@angular/ssr`.
@alan-agius4 alan-agius4 force-pushed the provide-server-rendering branch from 9ba1bb8 to 40cac84 Compare March 18, 2025 13:51
@alan-agius4 alan-agius4 added the action: review The PR is still awaiting reviews from at least one requested reviewer label Mar 18, 2025
@alan-agius4 alan-agius4 marked this pull request as ready for review March 18, 2025 13:57
Copy link

@AndrewKushnir AndrewKushnir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thanks @alan-agius4 👍

@alan-agius4 alan-agius4 added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Mar 18, 2025
@alan-agius4 alan-agius4 merged commit 26fd4ea into angular:main Mar 18, 2025
32 checks passed
@alan-agius4 alan-agius4 deleted the provide-server-rendering branch March 18, 2025 16:59
@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Apr 18, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker area: @angular/ssr area: @schematics/angular detected: feature PR contains a feature commit target: major This PR is targeted for the next major release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants