When I use require in my NodeJS + Typescript app I must add index.ts file to the url otherwise I get en error Cannot find module './api', e.g.
const api = require('./api/index.ts') - works
const api = require('./api') - not working
My package.json:
"dependencies": {
"@types/express": "^4.16.1",
"cors": "^2.8.5",
"express": "^4.16.4",
"mongoose": "^5.5.5",
"morgan": "^1.9.1",
"ts-node": "^8.1.0",
"ts-node-dev": "^1.0.0-pre.32",
"tslint": "^5.16.0",
"typescript": "^3.4.5"
}