Inside my html file, I have a script tag, of type module, where I import functions from Firebase via CDN.
One such function is an await function called setDoc. I need to use setDoc within a function I have written called save() which is triggered by a button.
What I have tried: The first error that I got is that save() "is not defined at HTMLButtonElement.onclick"
I moved my save() function in a separate script tag (which is not a module type) and it now works and is triggered upon a button click. However, I can't use the await Firebase function even though my save() is prefixed with async, because I need to import the Firebase functions again within the separate script tag. But I can't import the Firebase functions without making the separate script tag's type "module". So it feels kind of a circular problem for me.
How can I go about implementing the await method setDoc properly?