Closed SerG-Y closed 9 months ago
I have the same problem, if the build folder contains the build version (e.g. 3.0.0) Pixi doesn't load the assets correctly. If I remove the version, it works. I tried with old pixi version (4.8.5) and it works as expected!
My team encountered the same problem. Our deadlines coming up quickly, we had to revert to Pixi 6.5 to make things work for our game project.
My understanding is that this issue comes from the new Pixi.Assets module. We have 3 distinct issues on Pixi 7+
It seems to be introduced in #8614. In my opinion we should not remove the filename based on its "extension" in the join()
/ toAbsolute()
, but remove it if needed manually before calling them.
I also had an issue with this in production builds with version numbers. I used a patch to ignore moving to the parent if the extension found matched a version number pattern in the URL. In the following code, I added a check if there was a version number:
https://github.com/pixijs/pixijs/blob/dev/packages/utils/src/path.ts#L316
const urlFileExtension = this.extname(prevArg);
const isVersionNumber = urlFileExtension.match(/\.[0-9]+/);
if (urlFileExtension && !isVersionNumber) {
joined += `/../${arg}`;
} else {
joined += `/${arg}`;
}
It's unlikely that a file will have a numeric extension so this should work for both scenarios.
For people having the issue in current production builds, you can patch the function without forking the library. Reassign the function PIXI.utils.path.join to the patched function code before using the loader.
Hi, sorry for bothering @bigtimebuddy any updates on this one?
@bigtimebuddy thank you for your attention to this issue. I had some time to fix it, and I hope it will work. You can remove the bounty from this issue and save it for something more important :)
Current Behavior
Hi guys. When I am trying to load the file by url like
http://0.0.0.0:8080/games/game3.0/resources/config.json
pixi.js looking for it inhttp://0.0.0.0:8080/games/resources/config.json
. Is it correct behavior? I think the reason is thatgame3.0
in the base pathhttp://0.0.0.0:8080/games/game3.0
is recognized as an extension name and removed. https://github.com/pixijs/pixijs/blob/00009c14d64e3b15b900977ee188c3613f1ffa04/packages/utils/src/path.ts#L307Expected Behavior
File loads correctly
Steps to Reproduce
Try to load any file that contains a
dot
in the path.Environment
pixi.js
version: 7.2.3Possible Solution
No response
Additional Information
No response