Open
Conversation
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.
There was a problem hiding this comment.
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"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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