Media folder not rebuilt for WebP images

Have tried updating a site from Kirby 3.3.6 to 3.5 and it does not rebuild the media folder for my WebP images, which leads to the WebP images not loading.

I use GitHub - HashandSalt/kirby3-webp: A WebP helper for Kirby 3 to automatically convert uploaded images to WebP.

I am assuming it happens either because the WebP images do not have metadata, I see there are no .txt files for the WebP images, or because I use a string replace in a tag like this:

<?php foreach($data->children()->listed() as $project): ?>

            <?php // Convert the filename to a full file object
                $project_image = ($image = $project->projectimage()->toFile() ) ?  $image->url() : ''; 
                ?>
              
            
                <a class="<?php echo $project->title() ?> project"  href="<?php echo $project->url() ?>">
                <picture>
                    <source srcset="<?= str_replace(".jpg", ".webp",$project_image ); ?>" type="image/webp">
                    <source srcset="<?= $project_image ?>" type="image/jpeg">
                    <img class="projectimage" src="<?= str_replace(".jpg", ".webp",$project_image ); ?>" alt="<?php echo $project->title() ?>">
    		    </picture>

I have a lot of images over several sites, so any suggestions on how to best resolve this?

A file is only copied to the media folder, if its URL is called. However, you call the url() on the jpg file and then just replace that with the webp version.

So the correct way would be to actually fetch the file from the page folder, then call the url() method on that file.

That makes a lot of sense. Thank you!