Firebase v9 and Nuxt 2.15.8 - SyntaxError: Cannot use import statement outside a module

Solution 1:

For me importing firebase, I used the import method to bypass the SyntaxError: Cannot use import statement outside a module error. For example:

import("https://www.gstatic.com/firebasejs/9.6.1/firebase-app.js").then(
(firebase) => {
    const firebaseConfig = {
        apiKey: "",
        authDomain: "",
        projectId: "",
        storageBucket: "",
        messagingSenderId: "",
        appId: "",
        measurementId: ""
    };
    const app = firebase.initializeApp(firebaseConfig);
    //...
});

Of course in your case you would firebase/app instead of the remote js, but it is always another option.