Relative paths of files from main.js?

I’m trying to adhere to the folder structure in Sage, and I’m putting things like images within /assets/images/.

I’m trying to call the image from a function in main.js, but I simply cannot figure out the way to do relative filepaths. I’ve had no issue with relative filepaths on the same install for /assets/fonts/ from _global.scss.

/scripts/ and /images/ are both in the same level inside /assets/. I’ve tried ../images/logo.png and pretty much every other possible option and I keep getting 404 errors for the image. The browser seems to be looking for the image relative to the root URL rather than the location of main.js.

What can I do here?

The proper way would be to use wp_localize_script to output a variable that has the path to your theme or images directory