react-pdf-highlighter
react-pdf-highlighter copied to clipboard
pdf.js dependencies cannot be statically extracted
When running the example I run into the following warning:
./node_modules/pdfjs-dist/build/pdf.js
Critical dependency: require function is used in a way in which dependencies cannot be statically extracted
+1 I have the same issue.
Which build tool are you using?
@agentcooper I am using creat-react-app
which uses webpack and babel
Having the same issue on a project I'm working on, anyone got a fix for this yet?
Hi I am using webpack and yarn to build.
@mohammedri any overrides or customizations?
The example project works fine for me which uses create react app. It also works for me in the project I added this to. So I'm guessing this is either a version conflict or a configuration conflict.
If you are getting this error it would be super helpful if you paste your webpack config and output of npm ls
in a pastebin or gist and link it here.
I found it. It comes from newer versions of react-scripts
and using the default main export from pdfjs-dist
. As in, doing this:
import {...} from 'pdfjs-dist';
its fixed by
import {...} from 'pdfjs-dist/lib/pdf.js';