Skip to content

fix: detect @angular/platform-server to determine if Angular project uses SSR#10364

Open
swseverance wants to merge 3 commits intofirebase:mainfrom
swseverance:fix/angular-ssr-warning
Open

fix: detect @angular/platform-server to determine if Angular project uses SSR#10364
swseverance wants to merge 3 commits intofirebase:mainfrom
swseverance:fix/angular-ssr-warning

Conversation

@swseverance
Copy link
Copy Markdown

@swseverance swseverance commented Apr 16, 2026

Per #10362 a "SSR warning" message appears when performing firebase init hosting in Angular workspaces that do not use SSR. Now, the discover function for the Angular framework checks for the presence of @angular/platform-server in installed dependencies.

Description

This fix will prevent the following warning from being displayed in Angular workspaces that have no dependencies on @angular/ssr:

Detected a Angular codebase with SSR features. We can't guarantee that this site will work on Firebase Hosting, which is
optimized for static sites. Another product, Firebase App Hosting, was designed for SSR web apps. Would you like to use App
Hosting instead? Learn more here: https://firebase.google.com/docs/app-hosting/product-comparison#hostings

I know personally the first time I saw the warning message (in my codebase with no SSR) it made me think I had incorrectly initialized my Angular workspace to in fact use SSR.

Scenarios Tested

Scenario 1: SSR

  1. Create new workspace with SSR
ng new ssr --style css --ssr true --ai-config none
cd ssr
  1. Init hosting (this command will differ based upon the user)
node /Users/sam/Documents/firebase-tools/lib/bin/firebase.js init hosting
  1. Observe the "SSR warning" appears

Scenario 2: No SSR

  1. Create new workspace without SSR
ng new nossr --style css --ssr false --ai-config none
cd nossr
  1. Init hosting (this command will differ based upon the user)
node /Users/sam/Documents/firebase-tools/lib/bin/firebase.js init hosting
  1. Observe there is no "SSR warning"

Sample Commands

N/A

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates the Angular framework discovery logic to detect SSR support by checking for the @angular/ssr dependency. While this correctly identifies Angular 17+ projects, the reviewer pointed out that it misses older versions (16 and below) that rely on @angular/platform-server. To avoid regressions where older SSR projects are incorrectly identified as static, it is recommended to check for @angular/platform-server instead, as it is the core dependency for SSR across all Angular versions.

Comment thread src/frameworks/angular/index.ts Outdated
Comment thread src/frameworks/angular/index.spec.ts
Copy link
Copy Markdown
Contributor

@annajowang annajowang left a comment

Choose a reason for hiding this comment

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

lgtm once review comments are addressed

@annajowang annajowang requested a review from Yuangwang April 16, 2026 16:22
@swseverance
Copy link
Copy Markdown
Author

swseverance commented Apr 16, 2026

@annajowang I made the suggested changes and force pushed. Thank you

@swseverance swseverance changed the title fix: detect @angular/ssr to determine if Angular project uses SSR fix: detect @angular/platform-server to determine if Angular project uses SSR Apr 16, 2026
@swseverance swseverance force-pushed the fix/angular-ssr-warning branch from 12fbb65 to 23d4859 Compare April 16, 2026 17:26
…uses SSR

Previously, Angular's discover() always returned mayWantBackend: true,
causing the SSR warning to appear even for SPA-only Angular projects.
Now checks for the presence of @angular/platform-server in installed dependencies.

Resolves firebase#10362
@swseverance swseverance force-pushed the fix/angular-ssr-warning branch from 23d4859 to 00a93e2 Compare April 16, 2026 17:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants