Index.js won't recognize local img jpg file

I have tried many different lines of code, but for some reason my index.js doesn’t recognize my local jpg file that is in the same directory. I have checked that the path is correct. I’m trying to use my img constant to use in an HTML Rewriter that modifies a specific img element’s src.

But for some reason, the website builds but the picture doesn’t show. Here’s one the many lines of code that I’ve tried.
const img = ‘./’

I’ve also tried using require and import keyword but that didn’t help either.

1 Like

Are you using Worker SItes? If not, you will need to manually load the image to/from KV. You probably shouldn’t try to webpack your image into your script as you have a smaller limit on script size (1MB) than KV size (10MB).

Same issue. Did you end up solving this?