Skip to content

ngDevMode is undefined in an MFE with external or shared dependencies #4699

@bh3605

Description

@bh3605

Which @ngrx/* package(s) are the source of the bug?

signals

Minimal reproduction of the bug/regression with instructions

Kinda hard to replicate because it involves multiple projects, but the issue still remains this library is relying on an internal Angular flag when it should be calling the public api isDevMode()

Expected behavior

assertUniqueStoreMembers() relies on the isDevMode() method instead of the ngDevMode flag.

Versions of NgRx, Angular, Node, affected browser(s) and operating system(s)

NgRx: 18.*
Angular: 18.*

Other information

The issue is when this library is used in a micro-frontend that is using an external map of angular/core or specifying angular/core as a shared dependency then the call to assertUniqueStoreMembers() throws an error because ngDevMode is undefined. This method was introduced in version 18. What you should be doing is calling isDevMode() from @angular/core so as to not create a direct dependency on an internal Angular flag.

I would be willing to submit a PR to fix this issue

  • Yes
  • No

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