Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The entry points have side effects #502

Merged
merged 1 commit into from
Dec 19, 2019

Conversation

robsco-git
Copy link
Contributor

Webpack mode: production builds cause pdfjs fall back to the "fake
worker" with sideEffects: false in react-pdf's package.json.

I believe the optimisation related to sideEffects: false is preventing these lines from executing when using the Webpack entrypoint:

if (typeof window !== 'undefined' && 'Worker' in window) {
pdfjs.GlobalWorkerOptions.workerPort = new PdfjsWorker();
}

Relevant reading:
https://webpack.js.org/guides/tree-shaking/#mark-the-file-as-side-effect-free
https://stackoverflow.com/a/49203452/2410292

@wojtekmaj
Copy link
Owner

O, that might be why I had issues with Firefox on 5.0 beta 🤔

Please kindly rebase (broken build you fixed in #501).

Webpack "mode: production" builds cause pdfjs fall back to the "fake
worker" with "sideEffects: false" in "package.json".
@robsco-git
Copy link
Contributor Author

Done :)

@wojtekmaj wojtekmaj changed the title The enrty points have side effects The antry points have side effects Dec 19, 2019
@wojtekmaj wojtekmaj changed the title The antry points have side effects The entry points have side effects Dec 19, 2019
@wojtekmaj
Copy link
Owner

Thank you!

@wojtekmaj wojtekmaj merged commit 5647f01 into wojtekmaj:master Dec 19, 2019
alexandernanberg pushed a commit to alexandernanberg/react-pdf that referenced this pull request Jun 12, 2024
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.

2 participants