Skip to content

Make firebase a peer dependency of @angular/fire #3804

Closed

Description

@armando-navarro

AngularFire lists firebase under dependencies, so an app that requests a different firebase version than AngularFire does gets a second copy of the SDK nested under node_modules/@angular/fire/node_modules/firebase. The two copies reject each other's objects at runtime. That is the mechanism behind #3684, #3681 and #3682 on 21.0.0-rc.0, and the same failure is in older reports such as #3245 and #3442.

Proposal

Make firebase a peer dependency in AngularFire 22, so the app owns the single copy of the SDK:

  • firebase ^12.18.0 moves from dependencies to peerDependencies in the published package.json.
  • A migration-v22 for ng update adds firebase to the app's package.json when it is missing, and aligns an existing entry that is outside the range. ng update itself updates a peer the app already declares but never adds one. The migration reuses the alignment ng add already runs.
  • The v22 upgrade guide documents the change and the install-time error it produces.

What would change for apps

  • On npm, a firebase outside the supported range fails to install with ERESOLVE, which says which two versions conflict, instead of installing a second copy that fails at runtime.
  • On pnpm and Yarn, an out-of-range firebase installs as one copy with a peer warning. Yarn installs no peer dependencies at all, so an app that never declared firebase has to add it, which the migration does.
  • The ng add warning for two installed firebase versions stays. Under a peer dependency, two copies appear only when another package bundles its own firebase.

History

AngularFire 2.0 made firebase a peer dependency for this exact reason (#749, 2016), and 7.3.0 moved it back to dependencies (#3159, 2022). Seven of nine comparable wrapper libraries, including rxfire, reactfire and vuefire, list the SDK as a peer.

This is a breaking change, for 22.0.0.

Activity

  1. added this to the 22.0.0-rc.0 milestone on Oct 23, 2026
  2. added a commit that references this issue on Oct 23, 2026
    29ca012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    comp: coreFirebaseApp DI core (src/app).comp: docsDocumentation.comp: schematicsng add / deploy schematics (src/schematics).type: featureNew capability or enhancement.

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions