Skip to content

Add src/static-files to build assets#103

Open
amadulhaxxani wants to merge 1 commit intoclarin-v7from
98-render-the-static-pages-in-ssr-mode
Open

Add src/static-files to build assets#103
amadulhaxxani wants to merge 1 commit intoclarin-v7from
98-render-the-static-pages-in-ssr-mode

Conversation

@amadulhaxxani
Copy link

Update angular.json to include "src/static-files" in the build assets array so files placed there are copied into the build output. This ensures additional static resources are available at runtime without changing code paths.

Problem description

Static HTML files located in src/static-files/ were not included in the production SSR build output.
During server-side rendering, StaticPageComponent fetches these files via HttpClient. In production, the request resolves against dist/browser/, but since the files were not copied there, SSR returned 404 responses and static pages were not rendered correctly when accessed via tools like curl.

Analysis

The issue was caused by missing asset configuration in angular.json.
Adding "src/static-files" to the assets array ensures the files are copied into dist/browser/static-files/ during build, making them accessible at runtime for SSR without requiring changes to component or service logic.

Problems

No unexpected issues occurred. Build and SSR rendering were verified locally. Static pages now return HTTP 200 and correct content when accessed via curl.

Copilot review

  • ✅ Requested review from Copilot

Update angular.json to include "src/static-files" in the build assets array so files placed there are copied into the build output. This ensures additional static resources are available at runtime without changing code paths.
Copilot AI review requested due to automatic review settings February 16, 2026 14:17
@amadulhaxxani amadulhaxxani linked an issue Feb 16, 2026 that may be closed by this pull request
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request fixes an SSR issue where static HTML files in the src/static-files/ directory were not being copied to the production build output, causing 404 errors when accessed via server-side rendering. The fix adds "src/static-files" to the assets array in the angular.json build configuration, ensuring these files are copied to dist/browser/static-files/ during the build process.

Changes:

  • Updated angular.json to include "src/static-files" in the build assets array, following the same pattern as existing assets like "src/assets" and "src/robots.txt"

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.

Render the static pages in SSR mode

1 participant