diff --git a/CHANGELOG.md b/CHANGELOG.md index 351c9ecad..37d5edd7f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -127,6 +127,7 @@ are doing mtv adjustments during precollision. ### Fixed +- Fixed issue where unexpected html HTML content from an image would silently hang the loader - Fixed issue where Collision events ahd inconsistent targets, sometimes they were Colliders and sometimes they were Entities - Fixed issue where `ex.Engine.screenshot()` images may not yet be loaded in time for use in `ex.Transition`s - Fixed issue where there would be an incorrect background color for 1 frame when transitioning to a new scene diff --git a/src/engine/Resources/Resource.ts b/src/engine/Resources/Resource.ts index 09d7b8a03..945511faf 100644 --- a/src/engine/Resources/Resource.ts +++ b/src/engine/Resources/Resource.ts @@ -84,6 +84,15 @@ export class Resource implements Loadable { return; } + if (request.response instanceof Blob && request.response.type === 'text/html') { + const errorText = `Expected blob (usually image) data from the server when loading ${this.path}, but got HTML content instead! + +Check your server configuration, for example Vite serves static files from the /public folder`; + this.events.emit('error', request.response); + reject(new Error(errorText)); + return; + } + this.data = request.response; this.events.emit('complete', this.data as any); this.logger.debug('Completed loading resource', this.path);