Angularfire: universal prerendering fails with: import 'firebase/firestore'

Created on 10 Mar 2020  路  1Comment  路  Source: angular/angularfire

Version info

Angular: 9.0.0
Firebase: 7.10.0
AngularFire: 6.0.0-rc.1

How to reproduce these conditions

  • Create an angular app: ng new prerender-test
  • Add @angular/fire with schematics : ng add @angular/fire
  • Add angular universal : ng add @nguniversal/express-engine
  • Add import 'firebase/firestore'; in app.component
  • Run npm run prerender

Debug output

* Errors in the JavaScript console *

* Output from firebase.database().enableLogging(true); *

WARNING in ./node_modules/grpc/src/grpc_extension.js 32:12-33
Critical dependency: the request of a dependency is an expression
WARNING in ./node_modules/grpc/node_modules/node-pre-gyp/lib/pre-binding.js 20:22-48
Critical dependency: the request of a dependency is an expression
WARNING in ./node_modules/grpc/node_modules/node-pre-gyp/lib/util/versioning.js 17:20-67
Critical dependency: the request of a dependency is an expression
WARNING in ./node_modules/bytebuffer/dist/bytebuffer-node.js
Module not found: Error: Can't resolve 'memcpy' in './node_modules/bytebuffer/dist'

Prerendering 1 route(s) to /path/to/prerender-test/dist/browser
(node:3430) UnhandledPromiseRejectionWarning: Error: package.json does not exist at /path/to/prerender-test/dist/package.json

Expected behavior

Prerender should not fail.

Actual behavior

It fails

Most helpful comment

Addressing in #2347. Discussion here #2320. Work-arounds detailed in the comments. TLDR add @firebase/firestore to externalDependencies in your angular.json and I will cut the other fixes in the next RC.

>All comments

Addressing in #2347. Discussion here #2320. Work-arounds detailed in the comments. TLDR add @firebase/firestore to externalDependencies in your angular.json and I will cut the other fixes in the next RC.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

DennisSmolek picture DennisSmolek  路  3Comments

isylhdin picture isylhdin  路  3Comments

avanderbergh picture avanderbergh  路  3Comments

itisparas picture itisparas  路  3Comments

StephenFluin picture StephenFluin  路  3Comments