diff --git a/CHANGELOG.md b/CHANGELOG.md index 49451ac0..556fe18d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [Unreleased] + +### Added +- Check that path exists before calling `getStaticPath` on crosswalk assets in `prepareCrosswalk` + ## [0.47.7] - 2024-02-13 ### Added diff --git a/lib/index.js b/lib/index.js index 16afb8a1..da0354ff 100644 --- a/lib/index.js +++ b/lib/index.js @@ -332,7 +332,7 @@ export class Baker extends EventEmitter { !assetSources.png ) { throw new Error( - 'Crosswalk: Image assets require either a jpg or png file for basic compatibility.' + 'Crosswalk: Image assets require either a jpg or png file for basic compatibility. If you attempted to load a GIF file, they require a png or jpeg fallback for accessibility reasons.' ); } @@ -361,6 +361,12 @@ export class Baker extends EventEmitter { return; } + if (!path) { + console.warn( + `Could not find static path for asset: ${normalizedAssetName} with the extension: ${ext}. Skipping.` + ); + return; + } preppedData.assets[normalizedAssetType][normalizedAssetName][ext] = this.getStaticPath(path); });