phaserjs / phaserjs/phaser

Issue with loading Pack File of remote assets and local assets simultaneously

Open
#7,041 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

🗃 Loader
Dominant language
JavaScript
Stars
40.3k
Forks
7.2k
PR merge metrics
No merged PRs in 30d

Description

Version

  • Phaser Version: 3.88.0
  • Operating system: Windows 11
  • Browser:

Description

Existing forum discussion: https://phaser.discourse.group/t/how-to-load-packfile-with-remote-assets-and-local-assets-in-preload/15141/7

So I essentially wanted to migrate some assets from the github repo to an external source (Azure Blob Storage), and found that there's no way to set the base url to just affect the pack file (seems like adding a baseURL to the json/trying out on listeners also doesn't work). Adding https:// to the filepack json also doesn't seem to do anything, it uses the baseURL (localhost:3000/local url). setBaseURL also inevitably changes the baseURL for local assets as well, as shown in the reproduction below. Is there any way that's been exposed by phaser to properly load both remote and local assets in the preloader? I also found that the types for pack function to be incorrect, it only allows url, when it also allows the pack object which is what I need to use as I cannot just use a url due to nuxt/phaser path resolution conflicts and also code style reasons.

Example Test Code

https://stackblitz.com/edit/github-gzbuzr-udsq5dxy?file=models%2FStartScene.ts

Please ignore CORS errors and check the console, it will load (200 OK) for all the remote resources currently, but not work for local asset (a google image) as setBaseURL has overriden the local url.

Additional Information

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked StackBlitz reproduction, especially models/StartScene.ts, and trace the pack and setBaseURL entry points used during preload. Confirm the current behavior with the remote and local assets; done means both load together without the local URL being overridden, with the pack typing concern addressed if it is part of the fix.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
game-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.