0

I'm trying to use image to save the images in webp format, but the npm documentation to use it does an import imagemin from "imagemin" but nodejs v16.15.0 but it throws a syntax error on import

import imageminWebp from 'imagemin-webp';

(async () => {
    await imagemin(['images/*.{jpg,png}'], {
        destination: 'build/images',
        plugins: [
            imageminWebp({quality: 50})
        ]
    });

    console.log('Images optimized');
})();

I've tried using the require with default at the end but I still get the same error. I don't know how I could import it since the only ways I see are these, I'm importing it to use it inside a route controller

0 Answers0