I am trying to integrate Firebase in Cocos Creator (v 2.4.3)
Does anyone know what the best approach to this is? I am targeting the web platform.
I have tried using npm to integrate Firebase by following this blog,
but when I tried to import firebase in a script,
import * as firebase from 'firebase/app'; import "firebase/auth";
I get this error:
SyntaxError: ‘import’ and ‘export’ may only appear at the top level (2:0) while parsing C:/CocosProjects/firebaseTest3/node_modules/@firebase/auth/dist/auth.esm.js
If I comment out the 2nd line,
import * as firebase from 'firebase/app'; //import "firebase/auth";
I still get this error:
Error: Parsing file C:\CocosProjects\firebaseTest3\node_modules\firebase\app\dist\index.esm.js: ‘import’ and ‘export’ may only appear at the top level
I then tried to integrate Firebase using sdkbox from the Cocos Creator Extension Store, but when I launch sdkbox, Import and Update buttons are greyed out with this error:
Please build project before import plugins!
even though I already made a build for the empty scene
if anyone knows what I am doing wrong, please reply