I added Firebase Admin SDK to a react project (I used create-react-app if that makes a difference). I'm just testing it out so I just initialize Firebase in index.js
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
import './index.css';
var admin = require("firebase-admin");
var serviceAccount = require("./serviceAccountKey.json");
admin.initializeApp({
credential: admin.credential.cert(serviceAccount),
databaseURL: "https://<APP-NAME>.firebaseio.com/"
});
ReactDOM.render(
<App />,
document.getElementById('root')
);
Everything else in the project is essentially untouched. I go to run npm run build so I can deploy the project to Firebase hosting and get the following failed to compile error
Module not found: Error: Cannot resolve module 'request' in /home/ubuntu/workspace/shelf/node_modules/firebase-admin/lib/database
Any ideas what is the issue here or what I should do to solve it? Thanks!
firebasenotfirebase-admin) in your React app. - jwngr