I'm developing a game with PIXI.js that will be hosted on URL X and loaded on another website with URL Y.
In order to accomplish this, I use a BASE_URL environment variable that is ''
when local, and 'https://something.web.app'
when not local.
So, I can just do this:
import avatar from "../assets/images/avatar.svg";
const BASE_URL = process.env.BASE_URL || '';
loader.add(BASE_URL + avatar);
This seems to work, kind of. It seems to do the correct request first (with BASE_URL), and then again without BASE_URL. In the following picture you can see the erroneous second request:
This results in the image not being displayed in the game container.
If I omit the BASE_URL (like it was a few hours ago), it only requests the image once.
What can I try, here? I'm using ParcelJS to package this all.