How to copy all images from a src folder to a dist folder recursively using copy files npm module?

Using the copy files command, how can I copy images (.png, .jpg) from a “src” folder to the “dist” folder, while preserving the same filepaths internally. Should also work recursively.

https://www.npmjs.com/package/copyfiles

I have this

copyfiles(["src/**/*.png", "dist"], {u:2}, (err) => {
    if (err) {
        console.log("Error occurred while copying", err);
    }
    console.log("folder(s) copied to destination");
});

But it doesn’t seem to work. It creates the src folder inside dist folder.

Thanks