Hello,
I am currently working on a Firebase project, and it was working fine until I converted the JavaScript code to TypeScript. Since then, I’ve encountered many problems. I resolved most of the issues in the code, but there are still a couple of challenging ones that I can’t solve.
in this two lines of code:
// Import the functions you need from the SDKs you need
import { initializeApp } from "https://www.gstatic.com/firebasejs/10.13.0/firebase-app.js";
import { getDatabase, ref, set, onChildAdded , onValue } from "https://www.gstatic.com/firebasejs/10.13.0/firebase-database.js";
The first error was “exports is not defined at main.js:38:23”, which I fixed with this code: <script>var exports = {};</script>
in HTML file.
The second error is “main.js:40: require is not defined”, and I don’t know how to fix it.
If anyone can help, it would be greatly appreciated.
I tried to install firebase locally to my project and try to download webpack.config.js but the problem remains unsolved.