Lazy (dynamic) import of firebase modules triggers destructure error

The following import triggers the error Uncaught (in promise) TypeError: Cannot destructure property 'getAuth' of '(intermediate value).default' as it is undefined.:

const { getAuth, signInWithPopup, GoogleAuthProvider } = (await import('firebase/auth')).default;

Is there another way I should be lazy importing these modules from Firebase?


You don’t need to import .default export iirc, try this:

const { getAuth, signInWithEmailAndPassword } = await import("firebase/auth");

Works on version 9.0.0-beta.7:

enter image description here