// "app" is an instance of PixiJS Application export default app => (filename) => { const { resources, } = app.loader; const texture = Object .values(resources) .filter(resource => resource.textures) .flatMap(resource => Object.entries(resource.textures)) .find(([key]) => key === `${filename}.png`); if (!texture) throw new Error(`Texture "${filename}" not found.`); return texture[1]; }; // Example usage, assuming you have an image called 'player': // const texture = getTexture(‘player’) // const sprite = new Pixi.Sprite(texture)