Unable to use "Fit" in Vite app (React runtime)

I have a React (component in an Astro web app) and I’m trying to set the size of my layout according to the docs :

import { useRive, Layout, Fit } from "@rive-app/react-canvas";

export default function RiveHolder() {
  const { RiveComponent } = useRive({
    src: "/rive/hunza_g_01.riv",
    autoplay: true,
    layout: new Layout({
      fit: Fit.Layout, 
    }),
  });

If I don’t try to set the layout property (and don’t import the Layout and Fit exports), this works fine. However, when I want to set up the layout I get the following error.

[vite] Named export 'Fit' not found. The requested module '@rive-app/react-canvas' is a CommonJS module, which may not support all module.exports as named exports.

How can I fix this?