Getting started
Install
# npm
npm install -D firebase @e-chan1007/nuxt-firebase
# yarn
yarn add -D firebase @e-chan1007/nuxt-firebase
# pnpm
pnpm add -D firebase @e-chan1007/nuxt-firebase
Don't forget to install firebase
.
If you want to use Admin SDK, you have to install firebase-admin
, too.
WARNING
Versions listed below are not supported:
- Legacy (~ v8)
- v9.11.0 (isn't compatible with Nuxt)
Setup
- Add this module to the Nuxt config
export default defineNuxtConfig({
modules: [
'@e-chan1007/nuxt-firebase'
],
firebase: {
// set options here...
}
})
- Use in your pages, components or server routes
<template>
<p>Hello {{ currentUser?.displayName }}!</p>
</template>
<script lang="ts" setup>
const { currentUser } = useAuth();
</script>