Skip to content
This repository was archived by the owner on May 3, 2023. It is now read-only.
This repository was archived by the owner on May 3, 2023. It is now read-only.

Cannot find module error when entities are imported using absolute path #22

Description

@hitankar-freshworks

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions