skip to Main Content

I am attempting to add the Firestore client SDK to an Oracle JET project. I have run the following command to add the package to my project:

npm install [email protected] --save

After this, I know that the path_mapping.json file needs to be updated, however, I am unsure of what it should contain.

Path_mapping.json file:

"firebase/firestore": {
      "cdn": "3rdparty",
      "cwd": "node_modules/@firebase/firestore/dist",
      "debug": {
        "src": ["*.js", "*.map"],
        "path": "libs/@firebase/firestore/index.esm2017.js"
      },
      "release": {
        "src": ["*.js", "*.map"],
        "path": "libs/@firebase/firestore/index.esm2017.js"
      }
    }

TS file:

import { collection, getDocs, getFirestore } from "firebase/firestore";

Can I utilize the Firestore client SDK in an Oracle JET project? If so, what should the path_mapping.json file look like to add it?

2

Answers


  1. as You trying to achieve the connectivity

    {
      "firebase": {
        "cdn": "3rdparty",
        "cwd": "node_modules/@firebase",
        "debug": {
          "src": ["**/*.js", "**/*.map"],
          "path": "firebase/firestore/dist/index.esm.js"
        },
        "release": {
          "src": ["**/*.js", "**/*.map"],
          "path": "firebase/firestore/dist/index.esm.js"
        }
      }
    }
    
    
    import { initializeApp } from "firebase/app";
    import { getFirestore, collection, getDocs } from "firebase/firestore";
    
    // please add your firebase config Detils
    const firebaseConfig = {
      apiKey: "YOUR_API_KEY",
      authDomain: "YOUR_AUTH_DOMAIN",
      projectId: "YOUR_PROJECT_ID",
      storageBucket: "YOUR_STORAGE_BUCKET",
      messagingSenderId: "YOUR_MESSAGING_SENDER_ID",
      appId: "YOUR_APP_ID"
    };
    
    const app = initializeApp(firebaseConfig);
    const db = getFirestore(app);
    
    
    async function getCollectionDocs() {
      const querySnapshot = await getDocs(collection(db, "your-collection"));
      querySnapshot.forEach((doc) => {
        console.log(`${doc.id} => ${doc.data()}`);
      });
    }
    
    getCollectionDocs();
    

    aslo, make sure that paths in the path_mapping.json file match the actual paths in your node_modules directory.

    Login or Signup to reply.
  2. You can add your SDK oracle project through Google cloud firebase https://stackoverflow.com/questions/tagged/google-cloud-firestore

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search