Skip to content

💡 an issue with detecting unnecessary files in the monorepo project. #961

@vincent890120

Description

@vincent890120

Suggest an idea for Knip

I ran into a problem while using knip detection in a monorepo project.
Let me give you an example:
The project comprises two sub-packages, app and infrastructure, where app relies on infrastructure's baseMethod.
When I import the baseMethod() from '@infrastructure/lib/base' in app and run 'knip --production', the file 'packages/infrastructure/lib/base.ts' is flagged as unnecessary.
But when I import the baseMethod from 'infrastructure/lib/base', knip correctly identifies 'packages/infrastructure/lib/base.ts' as a necessary file. I'm wondering, why does the presence of the '@' symbol cause this misidentification?
Here's the layout of the project structure.
Image

Image Can you assist me? Could there be an issue with how I'm using knip?

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions