Webstorm cant resolve firebase 9 imports

My problem is that my IDE (WebStorm) doesn't recognize Firebase imports. It throws the following error:

Cannot resolve symbol getFirestore.

Here are my imports:

import { initializeApp, getApps } from "firebase/app";
import {
    getAuth,
    setPersistence,
    browserSessionPersistence,
} from "firebase/auth";
import { getAnalytics } from "firebase/analytics";
import { getFirestore } from "firebase/firestore";

The code works as it should, but Webstorm just cant recognize the imports, which also means that I get to autocompletion etc...

I've tried doing "invalidate cache and restart"
I've tried deleting node_modules and package.lock.json and reinstalled everything
I have the latest Webstorm version installed


It's a Vue3 project with the default Typescript setup coming from Vue Cli

1
5 comments

The @firebase module all the stuff is re-exported from is not listed as a dependency/devDependency in a package.json and thus is not indexed by default. You need marking node_modules/@firebase as Not excluded (Mark directory as/Not excluded from the folder right-click menu) to make this work

0

I havent got the possibility to mark it as not excluded ? 

0

Please try marking node_modules/@firebase and not node_modules/firebase - the latter is already indexed

1

Perfect, that worked... Thx a bunch

0
Avatar
Permanently deleted user

It doesn't work for firebase:9.1.3 - WebStorm 2021.2.3

It still imports from wrong source.

0

Please sign in to leave a comment.