-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Migration to @react-pdf/renderer v3.0.0 causes build and runtime failures #2028
Comments
Others have reported the same issues when upgrading. Can you try uninstalling and re-installing @react-pdf/renderer? The dependency |
@carlobeltrame The same issue with |
I see. Did you really uninstall and re-install react-pdf? It looks like you simply installed the font package instead of doing that. I just freshly installed react-pdf v3.0.0 in a project this week, and there were no problems whatsoever. And last month I also updated react-pdf in an existing project to v3.0.0, and had no problems with it. |
@carlobeltrame Yes, I did fresh install |
Thanks! From a first look, it looks like this is a problem with Webpack 4, nothing really seems to be wrong with react-pdf. If I upgrade your sample project to Webpack 5 (according to the razzle instructions here), everything works as normal again. My working projects use webpack 5 and vite, which explains why I had no problems upgrading. I found out that webpack 4 for some reason does not transpile the |
Someone in #2015 was quicker than me, and already found the root cause of the issue in webpack 4. If you cannot update to webpack 5, you either have to eject and adjust your config as described waku-org/js-waku#895 (comment) (or use craco or something similar to do that), or stay on @react-pdf/renderer < 3.0.0 until facebook/create-react-app#12605 or facebook/create-react-app#12021 is merged and released, and then update create-react-app. |
@carlobeltrame Thank you! Have you tried this comment waku-org/js-waku#895 (comment) in repository that I attached? I still can't get it working with webpack v4, so if you had a chance to have a look and procide some working example (in my repository) it would be really cool. |
I have tried it for a few hours, but did not manage to get it to work. Among other things, I tried setting the following razzle config: 'use strict';
module.exports = {
options: {
buildType: 'single-page-application',
},
modifyWebpackConfig ({ env: { target, dev }, webpackConfig, webpackObject, options: { pluginOptions, razzleOptions, webpackOptions }, paths }) {
webpackConfig['module']['rules'][0].test = /\.(js|mjs|jsx|ts|tsx|cjs)$/
console.log(webpackConfig['module'])
return webpackConfig
},
}; But that didn't help. That said, I don't really have much experience with Webpack 4 and React, and I have never heard of razzle before this issue, and don't really have time to get deeply accustomed with them. I recommend you do one of the following:
|
@carlobeltrame Thanks for trying and notes. I use second option for now until upgrade to Webpack 5. |
Describe the bug
After updating to @react-pdf/renderer v3.0.0 build job and runtime is failing with error:
To Reproduce
Steps to reproduce the behavior including code snippet (if applies):
Expected behavior
No errors after update.
Screenshots
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: