I want to change this below Firebase V8 code to Firebase V9 :
I tried many ways but it shows error
Please change this code to version 9
see full code : https://github.com/SimCoderYoutube/InstagramClone/blob/master/frontend/components/main/Save.js
import firebase from 'firebase/compat/app';
require("firebase/firestore")
require("firebase/firebase-storage")
const uploadImage = async () => {
const uri = props.route.params.image;
const childPath = `post/${firebase.auth().currentUser.uid}/${Math.random().toString(36)}`;
console.log(childPath);
const response = await fetch(uri);
const blob = await response.blob();
const task = firebase.storage()
.ref()
.child(childPath)
.put(blob);
const taskProgress = snapshot => {
console.log(`transferred: ${snapshot.bytesTransferred}`)
}
const taskCompleted = () => {
task.snapshot.ref.getDownloadURL().then((snapshot) => {
savePostData(snapshot);
console.log(snapshot)
})
}
const taskError = snapshot => {
console.log(snapshot)
}
task.on("state_changed", taskProgress, taskError, taskCompleted);
}
Node modules are installed correctly. But it shows Error:
./node_modules/firebase/firebase-storage.js:1
Module not found: Can't resolve 'https://www.gstatic.com/firebasejs/9.5.0/firebase-app.js'
> 1 | import { getApp, _getProvider, _registerComponent, registerVersion, SDK_VERSION } from 'https://www.gstatic.com/firebasejs/9.5.0/firebase-app.js';
2 |
3 | /**
4 | * @license