-
-
Notifications
You must be signed in to change notification settings - Fork 901
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
Compatibility with Webpack 4 / Create React App 2 #179
Comments
For users of Create React App 2, or anyone that is using webpack 4 in general. This issue appears as the following message when using the webpack entry point:
|
@wojtekmaj I requested that a new release that is webpack 4 compatible be pushed out last week (mozilla/pdf.js#9440 (comment)). It appears that they did cut a release that may work (2.0.550). How can we test this version works on our end? |
Hmmm, that's fairly easy. You can run project in |
Another issue to monitor before it gets resolved: mozilla/pdf.js#9733 |
Thanks! I'm going to take some time today to look into updating to the newer version as we discussed a few weeks ago. |
Upgrading should be as easy as changing a dependency for a new PDF.js version which uses new worker-loader and consequently supports Webpack 4, but drops support for Webpack 2. We're just waiting for a official pdf.js 2.0 release. |
@wojtekmaj I've just followed your instruction to test webpack4. Forked pdfjs-dist and react-pdf and it seems working well! (thanks for your work!!) |
No, that does not mean we shouldn't use bundler-specific entry points. They are there to kickstart you real fast. Although if you have pdf.worker.js provided on your own in correct location, you can safely use the default entry. I'm glad that Webpack 4 worked for you - I'll be upgrading it as soon as we get the confirmation from Mozilla that PDF.js 2.0 is ready to go. |
Any project using
Also, if you get Unfortunately, we encountered another error after upgrade to webpack 4, which wasn't solved by experimental switching from pdfjs-dist 2.0.489 to 2.0.550, see #248. |
I ran into issues where the worker.js bundle was not being loaded. I fixed it by adding a publicPath entry in my output object in webpack config, as well as globalObject: 'this' as explained above. See https://webpack.js.org/guides/public-path/ |
Sorry, I'm completely stuck because of dependencies. See mozilla/pdf.js#9580 for details. Any workarounds or contributions to mozilla's code are welcome. |
How is |
Webpack not so much, but In PDF.js 2.x, which is used internally by React-PDF 4.x, this dependency was upgraded to 2.0, which should solve some issues with Webpack 4. You can test React-PDF 4.x now and feedback is very welcome. |
So in theory, |
@SavePointSam Please read #280, other than that we're good I think. FYI all, we got info from Mozilla and React-PDF 4.0.0 final release should be out next week. |
Is that final release out yet? |
No it's not. We're blocked by mozilla/pdf.js#10205. I'm considering releasing 4.0.0 final with pdfjs-dist 2.0.550 at this point. |
Any update on this? I'm getting the same error (Uncaught ReferenceError: window is not defined) in a react-electron-boilerplate project. |
@wojtekmaj I've been trying to diagnose this for some time now, and I'm not sure how to proceed.
Is this still going to happen? What's the plan for now? |
@varunpatro 4.0.0 final was released a long time ago now. It should work fine with Webpack 4. If it isn't, it should be considered a bug. |
@wojtekmaj Does following warning go away with the most recent version?
|
@brydenfogelman No, this is tracked under #280 and is not closed. |
Looks like it resolved in this solution try this:
maybe you need to use lower version "pdfjs-dist": "1.8.357" |
Due to PDF.js being tightly coupled with worker-loader, at the moment we can't update the code so that it works with Webpack 4 flawlessly. It might work, but no guarantees can be made.
The issue has been filed against Mozilla's PDF.js in mozilla/pdf.js#9580 to separate Webpack specific code to another package, which would give us much more flexibility regarding fighting issues like that.
This issue is to be monitored.
The text was updated successfully, but these errors were encountered: