This does not work. Webpack bundles the asset packs in this format: asset-packs/[name]-[hash][ext][query]. So the browser just 404s when it attempts to get the asset pack.
The fix would be for the editor to add the correct asset pack import statements to the non-user edited section at the top of the scene file and use that in the auto-generated this.load.pack call.
Additional
I haven't tested the scenario where the user chooses to have multiple asset packs loaded with the scene. So I'm not sure if there's any additional issues there.
Version
Web Browser and version: Chrome 127.0.6533.99 (Apple Silicon)
Template: phaser-editor-template-webpack-ts
Description
I'm writing a course using Phaser Editor, and I noticed this when making a section about creating preloading screens.
The default template has the following in Preload.ts:
and further down
This does work. However, if the user tries to use the editor feature where they assign an asset pack to be preloaded on a scene:
Only this code is generated:
This does not work. Webpack bundles the asset packs in this format: asset-packs/[name]-[hash][ext][query]. So the browser just 404s when it attempts to get the asset pack.
What the browser is trying to load: http://localhost:8080/assets/preload-asset-pack.json
What the browser should be loading: http://localhost:8080/asset-packs/preload-asset-pack-322e64b4e68337cc0915.json
Possible solution
The fix would be for the editor to add the correct asset pack import statements to the non-user edited section at the top of the scene file and use that in the auto-generated this.load.pack call.
Additional
I haven't tested the scenario where the user chooses to have multiple asset packs loaded with the scene. So I'm not sure if there's any additional issues there.