eugene-manuilov/typeorm-uml

`Cannot find module` error when entities are imported using absolute path

hitankar-freshworks opened this issue · 1 comments

When using absolute path for importing entities, I get the following error:

›   Error: Cannot find module 'src/category/entities/category.entity'
 ›   Require stack:
 ›   - /usr/src/app/src/photo/entities/photo.entity.ts
 ›   - /usr/src/app/node_modules/typeorm/util/DirectoryExportedClassesLoader.js
 ›   - /usr/src/app/node_modules/typeorm/connection/ConnectionMetadataBuilder.js
 ›   - /usr/src/app/node_modules/typeorm/connection/Connection.js
 ›   - /usr/src/app/node_modules/typeorm/connection/ConnectionManager.js
 ›   - /usr/src/app/node_modules/typeorm/index.js
 ›   - /usr/src/app/node_modules/typeorm-uml/lib/TypeormUmlCommand.js
 ›   - /usr/src/app/node_modules/typeorm-uml/bin/run

This is how I am importing category
import { CategoryEntity } from 'src/module-1/entities/category.entity';

I have not found a way to resolve this and the only way these works is using relative paths. Is it possible to have support for using absolute paths when importing entities?

Hi, @hitankar-freshworks. Thanks for submitting it. Is your project publicly available? I want to see how it is configured to understand how to solve this problem. If not, can you create a small repo on GitHub that replicates your project configuration and has two tiny entities?