You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I don't understand this Vite documentation. My images should be in the resources folder, but the JS code still executes in the public folder. If css reads images without any problems ( background: url(../img/1.png) then JS will not do that, it wants to see that image in the public folder. And even if I write the full path to the image on the example of
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I don't understand this Vite documentation. My images should be in the resources folder, but the JS code still executes in the public folder. If css reads images without any problems
( background: url(../img/1.png)
then JS will not do that, it wants to see that image in the public folder. And even if I write the full path to the image on the example ofIt still won't see it unless I do it like this
const imgUrl = new URL('../../../../../img/interface/dexPodium.png', import.meta.url);
But, after the build, the images will be available in the public folder, so why should I write if it will be like
const imgUrl = new URL('./img/interface/dexPodium.png', import.meta.url);.
What am I doing wrong and what is the correct way for me to specify paths to images in my JS? All the answers I found are Vue related.
Beta Was this translation helpful? Give feedback.
All reactions