Package Exports
- supports-webp
- supports-webp/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (supports-webp) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
supports-webp 
Detect support for WEBP images in the browser in 0.3KB
Install
You can download the standalone bundle and include it in your manifest.json
.
Or use npm
:
npm install --save supports-webp
Usage
import supportsWebP from 'supports-webp';
// supportsWebP is a Promise
supportsWebP.then(supported => {
if (supported) {
console.log('Load WebP!');
} else {
console.log('Load JPEG!');
}
});
// Or if you can use async/await:
if (await supportsWebP) {
console.log('Load WebP!');
} else {
console.log('Load JPEG!');
}