0

I am new to the angular, I am following a course and there is aerror sshowing follows Module not found: Error: Package path ./compat is not exported from package D:\EcommeceWeb\App1\oshop\node_modules\firebase (see exports field in D:\EcommeceWeb\App1\oshop\node_modules\firebase\package.json) and auth.service.ts:16:49 - error TS2339: Property 'auth' does not exist on type 'typeof import("D:/EcommeceWeb/App1/oshop/node_modules/firebase/compat/index")'.

16 this.afAuth.signInWithRedirect(new firebase.auth.GoogleAuthProvider());

I need to slove this hear is my auth.service.ts

import { Injectable } from '@angular/core';
import { AngularFireAuth } from '@angular/fire/compat/auth';
import * as firebase from 'firebase/compat';
import 'firebase/compat/auth';
import 'firebase/compat/firestore';
import '@firebase/auth';
import { initializeApp } from 'firebase/app';
import { Observable } from 'rxjs/internal/Observable';





@Injectable({
  providedIn: 'root'
})
export class AuthService {
  user$: Observable<firebase.User>
  constructor(private afAuth : AngularFireAuth) { 
    this.user$=afAuth.authState;

  }

  login(){
    this.afAuth.signInWithRedirect(new firebase.auth.GoogleAuthProvider());

  }
  logout(){
    this.afAuth.signOut();

  }

}

  • this might be helpful to you https://stackoverflow.com/questions/70445014/module-not-found-error-package-path-is-not-exported-from-package – Gopal Dec 06 '22 at 06:13

0 Answers0