TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation
I am using @react-pdf/renderer which version is 2.1.0. I was using this packing last 1.5years but i wasn't facing this issue but now i am facing this issue in node version from 14 to 16. I am using react which version is 16.14. The above errors is due font font is not compiling. Earlier it was working. Pls suggest me what should i do so that font works using Font.register() method.
Thanks in advance.
same issue with this version as well 3.1.13
I'm using Font.register just fine in site docs and examples here. I'll need more data on how to reproduce
@diegomura pls use react-pdf/renderer 2.1.0, then you cant not use Font.register to register new font which is external. I am using react 16.14 and react-pdf-render 2.1.0
@santrajyadav196 Did you get the solution? I'm also facing the same issue.
My project runs fine locally but also facing the same issue after being packaged with Docker, adding this command in the Dockerfile, after npm i and before npm run build helps fix this error:
RUN find node_modules/@react-pdf -type f -name '*.js' -exec sed -i 's/fetch__default\["default"\](/(typeof fetch === "function" ? fetch : require("cross-fetch"))(/g' {} +
Anyone have a definitive solution?