I am getting this error in my middleware file auth.ts at line 4 i.e. import getConfig from '../configs/config'.
I am basically exporting a function from my config.ts as below:
config.ts
import dotenv from 'dotenv';
dotenv.config();
export default function () {
return {
port: process.env.PORT,
databaseUrl: process.env.DB_URL,
jwtAccessSecret: process.env.JWT_ACCESS_SECRET
}
}
auth.ts
import { Request, Response, NextFunction } from "express";
import jwt from 'jsonwebtoken';
import users from '../models/users';
import getConfig from '../configs/config'; // Getting error here
import '../types/express/extendRequest';
const { jwtAccessSecret } = getConfig();
.
.
.
I have used the same import statement in my server.ts, db.ts etc. and it runs without any issue.
Can anyone please help me figure out what the issue is?
Please let me know if any more info is required.
Thank you

