[WC-3050] Retrieve pdfjs worker locally instead of cdn - #1817
Merged
Conversation
gjulivan
force-pushed
the
document-viewer-local-pdfjs
branch
6 times, most recently
from
August 11, 2025 20:01
03e05ee to
2f12295
Compare
gjulivan
marked this pull request as ready for review
August 11, 2025 20:02
gjulivan
force-pushed
the
document-viewer-local-pdfjs
branch
2 times, most recently
from
August 12, 2025 11:15
7908040 to
2bddeee
Compare
gjulivan
force-pushed
the
document-viewer-local-pdfjs
branch
2 times, most recently
from
August 19, 2025 22:20
27561ca to
6d4485d
Compare
gjulivan
force-pushed
the
document-viewer-local-pdfjs
branch
2 times, most recently
from
August 29, 2025 08:20
e7af5a5 to
c05c050
Compare
gjulivan
force-pushed
the
document-viewer-local-pdfjs
branch
from
August 29, 2025 08:35
c05c050 to
3c1a7c7
Compare
gjulivan
force-pushed
the
document-viewer-local-pdfjs
branch
from
August 29, 2025 09:38
3c1a7c7 to
a69bc3e
Compare
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR updates the Document Viewer widget to bundle PDF.js worker files locally instead of loading them from a CDN, improving Content Security Policy (CSP) compliance. The changes involve downgrading the pdfjs-dist dependency to maintain compatibility with react-pdf.
- Configures Rollup to copy PDF.js worker files, cmaps, and standard fonts to the local build
- Updates PDF.js worker URL configuration to use local paths instead of CDN URLs
- Downgrades pdfjs-dist from version 5.0.375 to 4.8.69 for react-pdf compatibility
Reviewed Changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| rollup.config.mjs | Adds copy plugin to bundle PDF.js worker files and dependencies locally |
| package.json | Bumps version to 1.1.0 and downgrades pdfjs-dist to 4.8.69 for compatibility |
| PDFViewer.tsx | Updates worker and resource URLs to use local paths instead of CDN |
| CHANGELOG.md | Documents the change to local PDF.js worker bundling |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
gjulivan
force-pushed
the
document-viewer-local-pdfjs
branch
2 times, most recently
from
September 4, 2025 11:14
3c4fbde to
cdfa90f
Compare
gjulivan
force-pushed
the
document-viewer-local-pdfjs
branch
from
September 6, 2025 20:13
cdfa90f to
4ff3123
Compare
gjulivan
force-pushed
the
document-viewer-local-pdfjs
branch
from
September 9, 2025 12:08
4ff3123 to
bfd3a6a
Compare
leonardomendix
approved these changes
Sep 10, 2025
gjulivan
enabled auto-merge (rebase)
September 10, 2025 13:20
iobuhov
approved these changes
Sep 10, 2025
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.
Pull request type
Description
pdfjs-dist version has to be the same with react-pdf dependency
https://github.com/wojtekmaj/react-pdf/blob/5e0d135f5d1d3a3cec4628a2fc05a4a8f0bed9e7/packages/react-pdf/package.json#L60
this version use "4.8.69"