Skip to content

I cannot have two modules with same name in application. Is this a bug or a feature? #3362

@mikeconley12

Description

@mikeconley12

Current behavior

I cannot have two modules with same name in application. Only the first module will be available in the application. In my case, this is the AModule from "./my-a-module".

Input Code

Third party library

@Module({
    providers: [AService]
    exports: [AService]
})
export class AModule {
}

@Module({
    imports: [AModule],
    providers: [BService]
    exports: [BService]
})
export class BModule {
}

My code

import { BModule } from "third-party-library";
import { AModule } from "./my-a-module";

@Module({
    imports: [
    	AModule,
    	BModule
    ]
})
export class CModule {
}

Expected behavior

I am not sure if this is a bug. But I was expecting that I could have two separate Nest modules with same name.

Environment

"@nestjs/common": "^6.9.0",
"@nestjs/core": "^6.9.0"
 
For Tooling issues:
- Node version: v10.16.0
- Platform: Linux

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions