I'm trying to run combo Phaser + Spine2D + TypeScript + Webpack and I got issue with loading Spine things in Phaser via webpack. When I try to load things as usual
this.load.spineJson('skeleton-json', require('assets/skeleton.json'));
this.load.spineAtlas('skeleton-atlas', require('assets/skeleton.atlas'));
I got issue with atlas, cause in there, first line refers to skeleton.png
, but webpack hashes it so it's something like 12f12idgf1b3bi.png
, thus breaking the path to the file and receiving 404. Removing require
works fine locally, but after upload to web server it results in 404.
I tried loading atlas as text, then replacing paths, but this.load.spineAtlas
uses URL so it doesn't work as well
import atlas from 'assets/skeleton.atlas';
...
const customAtlas = atlas.replace(/skeleton\.png/g, require('assets/skeleton.png'));
None of those work:
this.load.spineAtlas('skeleton-atlas', customAtlas);
// or
this.load.text('skeleton-atlas', customAtlas);
customAtlas
is still treated as URL so it looks like localhost:808012f12idgf1b3bi.pngsize:2046,1890...
Do you have maybe any idea how to load it properly? :/