Hello,
I’m training with a video course. The code used firebase 5-5-1 and re-base 4.0.0 .
So I’m obligated to still the same versions to finish this cours.
My code is exactly the same of the video. I checked it several time.
The aim is to realize a realtime database for a chatbox.
This is the code of my base.js file:
import Rebase from 're-base';
import firebase from 'firebase/app';
import 'firebase/database';
const firebaseApp = firebase.initializeApp({
apiKey: 'AIzaSyAi1w45FAE6PWSuWipxjVnyZ5pg0QhVjC4',
authDomain: 'chatbox-app-4860f.firebaseapp.com',
databaseURL:
'https://chatbox-app-4860f-default-rtdb.europe-west1.firebasedatabase.app',
});
const base = Rebase.createClass(firebase.database());
export { firebaseApp };
export default base;
I draw your attention on the databaseURL above. It’s finish by “.app”. In the video it’s finish by ‘.com’. Maybe it’s the probleme , however I followed strictly the video during the creation of the database with firebase.
Then I import “base” component in my “App.js” like this:
import base from './base';
class App extends Component {
state = {
messages: {},
pseudo: this.props.match.params.pseudo,
};
componentDidMount() {
base.syncState('/', {
context: this,
state: 'messages',
});
}
....
The error message is :
./node_modules/re-base/dist/bundle.jsModule not found: Can't resolve 'firebase/app' in 'C:\Users\haddo\Documents\CODEUR\Anthony Welc - React 16+ Le Guide Complet (+Redux, React Router, Firebase)\05 - Projet 2 la Chat Box\base-chatbox-app\node_modules\re-base\dist'
what wrong with this code ?