1

How do I troubleshoot if a file inside of a package cannot be found?

./node_modules/react-pdf-highlighter/node_modules/pdfjs-dist/web/pdf_viewer.css
Error: Module not found: Can't resolve 'images/loading-icon.gif'

I am trying to use the react-pdf-highlighter in a nextjs project.

I have tried adding file-loader for .gif in my webpack.

It seems like the issue is inside of the react-pdf-highlighter, since it is inside of its node_modules.

Of course I would like to know the reply to this specific problem, but even more: How do I approach this type of issue? Are there steps that can be taken to figure out how to solve this?

Atonic
  • 509
  • 1
  • 5
  • 14

2 Answers2

0

Your Image must be in public. To access it in jsx type:

/images/loading-icon.gif
Digamber negi
  • 407
  • 1
  • 7
  • 20
0

You don't actually need to troubleshoot "not found" error

You need to go to your node_modules folder and check your package for the existing file. If your file pdf_viewer.css exists, just change the placing of this file to, for example, your root.

After, what I see, you have no file called loading-icon.gifin images/loading-icon.gif', add it to the images folder. Also check your pdf_viewer.css, I am sure your gif is loaded somewhere there.

illia chill
  • 1,652
  • 7
  • 11