firestore #
Initializes Firebase Firestore and makes it available via $fire.firestore
and $fireModule.firestore
.
- Type:
Boolean
orObject
- Default:
false
firestore: {
memoryOnly: false, // default
chunkName: process.env.NODE_ENV !== 'production' ? 'firebase-auth' : '[id]', // default
enablePersistence: true,
emulatorPort: 8080,
emulatorHost: 'localhost',
settings: {
// Firestore Settings - currently only works in SPA mode
}
}
memoryOnly #
With this flag set to true, the memory-only build is loaded as mentioned here.
- Type:
Boolean
orObject
- Default:
false
enablePersistence #
Enables persistence in web apps.
- Type:
Boolean
orObject
- Default:
false
firestore: {
// ...
enablePersistence: true
}
// or
firestore: {
// ...
enablePersistence: {
/**
* Whether to synchronize the in-memory state of multiple tabs. Setting this
* to 'true' in all open tabs enables shared access to local persistence,
* shared execution of queries and latency-compensated local document updates
* across all connected instances.
*
* To enable this mode, `synchronizeTabs:true` needs to be set globally in all
* active tabs. If omitted or set to 'false', `enablePersistence()` will fail
* in all but the first tab.
*/
synchronizeTabs: true
}
}
More information here.
emulatorPort #
- Type:
Integer
- Default:
null
Sets up useEmulator("localhost", EMULATOR_PORT)
to point to a Firestore emulator running locally.
More information in the official Firebase Emulator Docs.
INFO
To not use the emulator in production you can do the following:
emulatorPort: process.env.NODE_ENV === 'development' ? 8080 : undefined
emulatorHost #
- Type:
String
- Default:
localhost
,
Changes the host used for the emulator. Only applies if the emulatorPort is set.
settings #
Adds settings to your Firebase initialization, e.g. host
or ssl
. See more here.
Important
When using settings() in Universal mode (see this issue), you need to set runInNewContext
to false
in your nuxt.config.js like so:
// Add this to your nuxt.config.js
render: {
bundleRenderer: {
runInNewContext: false
}
},
:::