I'm currently working on a NestJS application and using ts-migrate-mongoose for database migration. The issue I'm facing is related to importing a user schema from outside of the migration folder (which is located in the root folder by default). When I import with an absolute path, I encounter a path resolution error:
import { UserModel } from 'src/modules/user/repository/user.model';
Error: Cannot find module 'src/modules/user/repository/user.model'
However, if I use a relative path like this, it creates an error after entering the user model file where another import with an absolute path is present:
import { UserModel } from '../src/modules/user/repository/user.model';
It works fine until I have an import like this in the user model file:
import { User, UserStatus } from 'src/entity/user.entity';
This causes another path resolution error. In such cases, removing all absolute imports doesn't seem like a practical solution.
In my ts-config file, I have set the baseUrl to './'.
I've tried uninstalling and reinstalling the package, expecting it to resolve the issue, and also attempted installing it as a global package.