react-pdf icon indicating copy to clipboard operation
react-pdf copied to clipboard

TypeError: module.runSetters is not a function

Open sherryysj opened this issue 2 years ago • 7 comments

Describe the bug It throws this error module.runSetters is not a function when I use it on Meteor React JS.

I also tried npm ci, delete node module then reinstall, and also on version 2.3.0, all throw the same error as well.

image

Code: image

image

Similar questions found online: https://stackoverflow.com/questions/73636378/i-am-trying-to-integrate-react-pdf-renderer-in-my-proyect-and-i-get-this-error/73642851#73642851

To Reproduce

You can make use of react-pdf REPL to share the snippet

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. MacOS, Windows]
  • Browser [e.g. chrome, safari]
  • React-pdf version [e.g. v1.1.0]

sherryysj avatar Sep 08 '22 00:09 sherryysj

Same problem

LucianoCanziani avatar Sep 08 '22 01:09 LucianoCanziani

Here's a very simple reproduction of the error: https://github.com/Floriferous/react-pdf-meteor-error

Floriferous avatar Sep 12 '22 11:09 Floriferous

Here's a very simple reproduction of the error: https://github.com/Floriferous/react-pdf-meteor-error

Thanks for this!!!!

sherryysj avatar Sep 12 '22 23:09 sherryysj

It seems like version 2.1.2 created this bug, whereas on 2.1.1 everything works fine. v3 has the same issue.

I tried with React 17 and 18, but there's no difference.

Floriferous avatar Sep 13 '22 14:09 Floriferous

Thanks! I am going to have a look for 2.1.1, if there are not many differences with 2.3, I could roll back to use that version for now.

sherryysj avatar Sep 14 '22 02:09 sherryysj

This talk about Meteor's Reify operation (https://blog.meteor.com/reify-meteors-evolving-javascript-module-compiler-70425fa45d81). This seems to be a problem related to Reify. Since React-PDF is an NPM library could you try to recompile it with Meteor's compiling system and see if there is any change (https://guide.meteor.com/using-npm-packages.html#recompile). I am not sure what changed here between versions. Will try to understand this a bit deeper.

paulincai avatar Sep 14 '22 09:09 paulincai

Could be related to adding this: 'rollup-plugin-polyfill-node'

paulincai avatar Sep 14 '22 09:09 paulincai