React - Failed to resolve import "../data.json"

Hi there!
I have an issue displaying images with external URL. I use Vite.

Here is the logic:
data.json stores multiple image URL. ( src/data.json)
{
“image_url”: “https://i.imgur.com/f82yZ4A.png
}

about.jsx - display the image
import data from “…/data.json”; // import the data.json file

Product

I keep this error

Let me know an alternative solution or what could be the issue.

Best
P.

We can’t see what the error is, that’s just where the error is being triggered

That’s all I can share… there is no error number…I got this

Whe an error gets thrown it normally says something descriptive, you’ve cut that part out of the screenshot and cropped it to just show the location of the error

.. moves up to components not src

1 Like

It works :slight_smile: Thank you so much

No problem, but as said you can now understand why it is important that we can see more than just the error location. If you had cropped the top of the image just a little more I wouldn’t have been able to see the path.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.