Webpack 4 & Multiatlas?

@rich or somebody, please help?

I am just trying to use https://github.com/photonstorm/phaser3-project-template a brilliant Webpack 4 implementation for my project already started with a different plan.

My template loads from http://myserver/assets/graphics/pdw1A@4.json

this.load.multiatlas("bigBackground", assets/graphics/pdw1A@${assetsDPR}.json, "assets/graphics");

… should work but no, 404. This is no good either:

this.load.bitmapFont('gameplay-black', 'assets/fonts/gameplay-1987-black.png', 'assets/fonts/gameplay-1987-bw.fnt');this.load.bitmapFont('gameplay-black', 'assets/fonts/gameplay-1987-black.png', 'assets/fonts/gameplay-1987-bw.fnt');

I did read some webpack.js.org content but can’t figure it out, can you? Thanks!

Are you getting a 404 for the .json or the textures?
I think you have to set the path first, otherwise the textures will be loaded from the root folder.

See topic #1203

1 Like

I have this working with multiatlas and webpack 4.20.4.

I build my files into ./dist and I publish my TexturePacker multiatlas into ./dist/img/assets.

Loading the atlas with scene.load.multiatlas('key', './dist/img/assets/file.json);

The catch, is that the TexturePacker texturepath property doesn’t work, so I had to do a find/replace within the json file to add the './dist/img/assets/' path in front of the image property. In my case I have sd,md,hd variants, so three json files. Adding the path in the json files fixes the issue, other wise the images are loaded from the project root.

1 Like