Open SamyPesse opened 4 years ago
When using tsconfig-paths with ts-node, it conflicts a require of a node modules having the same name as a JSON file in the root folder.
tsconfig-paths
ts-node
Basically here is a tree to represent the issue:
node_modules/ firebase/ @firebase/testing/ index.js => contains a "require('firebase')" firebase.json package.json script.ts => import "@firebase/testing"
Running script.ts with ts-node/tsconfig-paths fails because the require('firebase') returns the content of the firebase.json.
script.ts
require('firebase')
firebase.json
Workaround: In the paths typescript config, I've added:
paths
"paths": { "firebase": ["node_modules/firebase"] }
I ran into this same issue today and was quite confused what was happening! It would be great if this could be fixed to prevent others from spending time debugging this weirdness.
When using
tsconfig-paths
withts-node
, it conflicts a require of a node modules having the same name as a JSON file in the root folder.Basically here is a tree to represent the issue:
Running
script.ts
withts-node
/tsconfig-paths
fails because therequire('firebase')
returns the content of thefirebase.json
.Workaround: In the
paths
typescript config, I've added: