File tree Expand file tree Collapse file tree 2 files changed +17
-5
lines changed Expand file tree Collapse file tree 2 files changed +17
-5
lines changed Original file line number Diff line number Diff line change @@ -143,11 +143,16 @@ export default defineNuxtModule<VueFireNuxtModuleOptions>({
143143 }
144144
145145 // Emulators must be enabled after the app is initialized but before some APIs like auth.signinWithCustomToken() are called
146+ const isEmulatorEnabled =
147+ typeof options . emulators === 'object'
148+ ? options . emulators . enabled
149+ : ! ! options . emulators
150+
146151 if (
147152 // Disable emulators on production unless the user explicitly enables them
148153 ( process . env . NODE_ENV !== 'production' ||
149154 process . env . VUEFIRE_EMULATORS ) &&
150- options . emulators
155+ isEmulatorEnabled
151156 ) {
152157 const emulators = await detectEmulators (
153158 options ,
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ import type { VueFireNuxtModuleOptions } from './options'
1212 * @param logger - The logger instance
1313 */
1414export async function detectEmulators (
15- { emulators : emulatorOptions , auth } : VueFireNuxtModuleOptions ,
15+ { emulators : _emulatorsOptions , auth } : VueFireNuxtModuleOptions ,
1616 firebaseJsonPath : string ,
1717 logger : ConsolaInstance
1818) {
@@ -33,19 +33,26 @@ export async function detectEmulators(
3333 return
3434 }
3535
36+ // normalize the emulators option
37+ const emulatorsOptions =
38+ typeof _emulatorsOptions === 'object'
39+ ? _emulatorsOptions
40+ : {
41+ enabled : _emulatorsOptions ,
42+ }
43+
3644 const { emulators } = firebaseJson
3745
3846 if ( ! emulators ) {
39- if ( emulatorOptions === true ) {
47+ if ( emulatorsOptions . enabled !== false ) {
4048 logger . warn (
4149 'You enabled emulators but there is no `emulators` key in your `firebase.json` file. Emulators will not be enabled.'
4250 )
4351 }
4452 return
4553 }
4654
47- const defaultHost : string =
48- ( typeof emulatorOptions === 'object' && emulatorOptions . host ) || '127.0.0.1'
55+ const defaultHost : string = emulatorsOptions . host || '127.0.0.1'
4956
5057 const emulatorsToEnable = services . reduce ( ( acc , service ) => {
5158 if ( emulators [ service ] ) {
You can’t perform that action at this time.
0 commit comments