I have a TypeScript project that consists of multiple .ts files which need to be compiled into .js files for use in other projects.
One of the files requires the firebase package but it's not being found. The package is installed and located inside the node_modules folder. When I try:
import firebase from 'firebase';
and run tsc
, I encounter the following error:
lib/api.ts:2:22 - error TS2307: Cannot find module 'firebase'.
2 import firebase from 'firebase';
~~~~~~~~~~
Found 1 error.
I've attempted deleting the node_modules folder, package-lock.json, and running npm uninstall firebase, but none of these solutions seem to be effective.
Here is my package.json:
{
"name": "project-models",
"version": "1.0.1",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"private": true,
"scripts": {
"build": "tsc",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Jonas Wallmann",
"license": "ISC",
"dependencies": {
"firebase": "^6.2.3"
},
"devDependencies": {
"typescript": "^3.5.2"
}
}
And here is my tsconfig.json:
{
"compilerOptions": {
"target": "esnext",
"declaration": true,
"outDir": "./dist",
"strict": false,
"strictPropertyInitialization": false,
"esModuleInterop": true
}
}
Any advice on how to resolve this issue?