diff --git a/packages/core/src/textures/resources/ImageBitmapResource.ts b/packages/core/src/textures/resources/ImageBitmapResource.ts index ea09396412..aab555fd54 100644 --- a/packages/core/src/textures/resources/ImageBitmapResource.ts +++ b/packages/core/src/textures/resources/ImageBitmapResource.ts @@ -59,18 +59,23 @@ export class ImageBitmapResource extends BaseImageResource { options = options || {}; + let baseSource; + let url; + if (typeof source === 'string') { - super(ImageBitmapResource.EMPTY); - - this.url = source; + baseSource = ImageBitmapResource.EMPTY; + url = source; } else { - super(source); - - this.url = null; + baseSource = source; + url = null; } + // Using super() in if() can cause transpilation problems in some cases, so take it out of if(). + // See https://github.com/pixijs/pixijs/pull/9093 for details. + super(baseSource); + this.url = url; this.crossOrigin = options.crossOrigin ?? true; this.alphaMode = typeof options.alphaMode === 'number' ? options.alphaMode : null;