Repository navigation
fix(web): publish the pdf.js worker as .js so Amplify serves it (#726) - #736
Merged
Merged
Conversation
On staging the PDF viewer always fell back to "Documentul nu poate fi afișat aici": the contract file loaded (200), but the worker assets/pdf.worker.min-*.mjs came back as index.html (text/html). The Amplify rewrite in terraform-ngohub modules/amplify sends every extension outside css|gif|ico|jpg|js|png|txt|svg|webp|woff|ttf|map|json to index.html, and .mjs is not in the list, so pdf.js fell back to a fake worker and could not render. The build now names .mjs assets .js. The worker is still loaded as a module worker; no infrastructure change is needed on staging or production. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.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.
On staging the web PDF viewer (#726) always shows „Documentul nu poate fi afișat aici. Îl poți descărca”.
Cause
assets/pdf.worker.min-*.mjscomes back asindex.html(content-type: text/html).modules/amplify/amplify.tfsends every extension outsidecss|gif|ico|jpg|js|png|txt|svg|webp|woff|ttf|map|jsontoindex.html, and.mjsis not in that list.Fix
vite.config.tsnames.mjsassets.js. The build now emitsassets/pdf.worker.min-<hash>.js,PdfDocumentpoints at it, and pdf.js still loads it as a module worker. No infrastructure change is needed on staging or production, and the shared Amplify module (used by NGO Hub and the other sites) stays as it is.Checked
.jsand is the only.mjsasset affected.🤖 Generated with Claude Code