Production build shows blank screen with vite (23.2.2)

@winsome-wombat
Dev mode build works fine, but when I try to run a production build (successfully), nothing except the vaadin loading bar at the top loads, and a javascript error is shown (fetch is not a function).
After spending a day with our project trying to narrow down the issue, it boiled down to this code:
Camera.java

@Tag("photo-camera")
@JsModule("./typescript/camera.ts")
@NpmPackage(value = "isomorphic-fetch", version = "3.0.0")
@NpmPackage(value = "fetch-retry", version = "5.0.2")
public class Camera extends LitTemplate {
    public Camera() {
    }
}

camera.ts

// @ts-ignore
import * as originalFetch from 'isomorphic-fetch';
import f from 'fetch-retry';
const fetch = f(originalFetch);

Production build shows blank screen with vite (23.2.2)