0

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:

Problematic 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.

Jeff Huijsmans
  • 1,388
  • 1
  • 14
  • 35

1 Answers1

0

I simply forgot to do BASE_URL + avatar somewhere else. Oops.

Jeff Huijsmans
  • 1,388
  • 1
  • 14
  • 35