Skip to content
This repository has been archived by the owner on Sep 7, 2021. It is now read-only.

Commit

Permalink
build: setup firebase emulator
Browse files Browse the repository at this point in the history
firebaseui emulator pending for firebase/firebaseui-web#778
  • Loading branch information
Sun Haoran committed Feb 3, 2021
1 parent 4959f12 commit 47a2dee
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 12 deletions.
11 changes: 2 additions & 9 deletions firebase.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
{
"hosting": {
"public": "dist",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"ignore": ["firebase.json", "**/.*", "**/node_modules/**"],
"rewrites": [
{
"source": "**",
Expand All @@ -21,10 +17,7 @@
"port": 5001
},
"firestore": {
"port": 8080
},
"hosting": {
"port": 5000
"port": 8090
},
"ui": {
"enabled": true
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint",
"emulate:func": "firebase emulators:start --only functions",
"emulate": "firebase emulators:start",
"deploy:func": "firebase deploy --only functions"
},
"dependencies": {
Expand Down
8 changes: 6 additions & 2 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,17 @@ firebase.initializeApp({
/* cSpell:enable */

const functions = firebase.app().functions('europe-west1')
const db = firebase.firestore()
if (process.env.NODE_ENV == 'development') {
functions.useEmulator('localhost', 5001)
const emulatorConfig = require('../firebase.json').emulators
functions.useEmulator('localhost', emulatorConfig.functions.port)
// firebase.auth().useEmulator(`http://localhost:${emulatorConfig.auth.port}/`)
db.useEmulator('localhost', emulatorConfig.firestore.port)
}

app.config.globalProperties.$firebase = firebase
// unnecessary, but easy reference
app.config.globalProperties.$db = firebase.firestore()
app.config.globalProperties.$db = db
app.config.globalProperties.$func = functions
app.config.globalProperties.$user = null
router.app = app
Expand Down

0 comments on commit 47a2dee

Please sign in to comment.