Directory import ‘[~]/node_modules/firebase/app’ is not supported resolving ES modules imported from /[~]
Did you mean to import firebase/app/dist/index.cjs.js?

When you applying Firebase into your Node.js project, You faces a bunch of errors.

Here is the most common errors.

.. is not supported resolving ES modules imported from ..

https://firebase.google.com/docs/web/setup?authuser=0#node.js-apps

This is the official guide. But it doesn’t work.

So you have to add a scoped package symbol ‘@’

Now, the error is changed.

It has not the function, the initializeApp function.

if you import firebase as partly, not just whole package. you have to set the firebase/app package as just firebase.

and You have to change the way to call the initializing function.

You will succeed to run.

Full Code

Dropout from Physics, self-taught and worked on the IT industry as a Dev/Design/Planning for 8 years. And I had run my Startup for 3 years. I fancy a ☔️ 🇬🇧