Console warning about a fake worker on PDF load and PDF takes a few seconds to load
Issue was happening because we need to set a path for the workerSrc but this path will be different for every app that imports this library so the worker was not being found and a fake worker was being used instead.
Fixed by updating initPdfWorker() to point workerSrc to a CDN instead of using Webpack to load the worker. We can figure out how to configure this path properly if we have time at the end of the quarter but for now using a CDN is sufficient.
Webpack adds 2 unexpected files to our bundled output with weird hash names
These files contained the worker and worker license and were being generated by Webpack due to the React PDF entry.webpack using the file-loader plugin. The worker files are no longer needed due to the worker being included via CDN.
Fixed by updating import paths from react-pdfs Webpack entrypoint to main entrypoint
Published new v0.0.9 to npm so now the hash files are not in our published package
Reviewer Instructions
There is a CSS change in pdf-components-dist.css that is unrelated to this specific PR but got included in the build because we haven't built/published since it got merged in.
Testing Plan
Tested Reader demo app. PDF loads successfully and quickly and there is no fake worker warning in the console.
Published to npm and tested in Semantic Reader. PDF loads successfully and quickly and there is no fake worker warning in the console.
Output / Screenshots
UI: Same as before minus fake worker warning in console.
Description
This is a fix for issue #67.
This PR addresses the following issues:
workerSrc
but this path will be different for every app that imports this library so the worker was not being found and a fake worker was being used instead.initPdfWorker()
to pointworkerSrc
to a CDN instead of using Webpack to load the worker. We can figure out how to configure this path properly if we have time at the end of the quarter but for now using a CDN is sufficient.entry.webpack
using thefile-loader
plugin. The worker files are no longer needed due to the worker being included via CDN.react-pdf
s Webpack entrypoint to main entrypointReviewer Instructions
There is a CSS change in
pdf-components-dist.css
that is unrelated to this specific PR but got included in the build because we haven't built/published since it got merged in.Testing Plan
Output / Screenshots
UI: Same as before minus fake worker warning in console.