I am trying to simply just render a PNG image that I have placed in the ./public/assets/images directory in my Next JS project. I have used the next-images package for the same. However, I still keep getting an error saying
./public/assets/images/delivery-boy.png TypeError: unsupported file type: undefined (file: undefined)
Here's my code for that component
import React from 'react' import deliveryBoy from '../../../public/assets/images/delivery-boy.png' import Image from 'next/image' const MedicalStoreScreen = () => { return ( <div className="med-store-screen" > <div className="section-title-container"> <div className="heading">Medical Store</div> <div className="sub-heading">medicine home delivery</div> </div> <div className="med-store-info-container"> <div className="img-container"> <img src={deliveryBoy} /> </div> <div className="content-container"> <div className="content">24/7 Delivery in 30 minutes</div> <div className="content">Upto 30% discount</div> </div> </div> </div> ) } export default MedicalStoreScreen Here's the code for my next.config.js file
const withImages = require('next-images') module.exports = withImages() Can someone please suggest what's going wrong in rendering this PNG image in my Next JS app?
<Image />provided by default.<Image/>has been failing in the latest next Js build so that is why PNG image is not getting detected. You can find the solution for the same here - stackoverflow.com/questions/68008498/…