Check if sharp is failing on bundle before running image minimizer
							parent
							
								
									1316a3d7d8
								
							
						
					
					
						commit
						86c2769221
					
				| 
						 | 
				
			
			@ -28,8 +28,10 @@ const ImageMinimizerPlugin = require('image-minimizer-webpack-plugin');
 | 
			
		|||
 | 
			
		||||
let isSharpAvailable = true;
 | 
			
		||||
try {
 | 
			
		||||
  require.resolve('sharp');
 | 
			
		||||
} catch (e) {
 | 
			
		||||
  const sharp = require('sharp');
 | 
			
		||||
  // It is possible that sharp is installed but fails on running
 | 
			
		||||
  sharp();
 | 
			
		||||
} catch {
 | 
			
		||||
  isSharpAvailable = false;
 | 
			
		||||
  console.warn('Sharp is not available, image optimization will be disabled.');
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue