fix: include frontend_path in sirv prod command for correct 404.html fallback#6154
Open
fix: include frontend_path in sirv prod command for correct 404.html fallback#6154
Conversation
…fallback When frontend_path is set, the build moves all static files (including 404.html) into a subdirectory, but the sirv --single flag was hardcoded to look for 404.html at the root. This broke dynamic routes in prod. Closes #5812 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Merging this PR will degrade performance by 3.03%
Performance Changes
Comparing |
Contributor
Greptile SummaryThis PR fixes a bug where dynamic routes in production break when Key changes:
One remaining issue: the old Confidence Score: 4/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["_compile_package_json()"] --> B["get_config()"]
B --> C{{"config.frontend_path"}}
C -->|empty string or '/'| D["fallback = '404.html'"]
C -->|e.g. '/app'| E["stripped = 'app'<br/>fallback = 'app/404.html'"]
C -->|e.g. '/deep/nested'| F["stripped = 'deep/nested'<br/>fallback = 'deep/nested/404.html'"]
D --> G["sirv ./build/client --single 404.html --host"]
E --> H["sirv ./build/client --single app/404.html --host"]
F --> I["sirv ./build/client --single deep/nested/404.html --host"]
G --> J["Written to package.json 'prod' script"]
H --> J
I --> J
Last reviewed commit: 0ef95c4 |
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
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.
When frontend_path is set, the build moves all static files (including 404.html) into a subdirectory, but the sirv --single flag was hardcoded to look for 404.html at the root. This broke dynamic routes in prod.
Closes #5812