Nuxt Firebase
Integrate Firebase with Nuxt (3)
Install
npm install -D firebase @e-chan1007/nuxt-firebase
yarn add -D firebase @e-chan1007/nuxt-firebase
pnpm add -D firebase @e-chan1007/nuxt-firebase
Don't forget to install firebase
.
Setup
- Add this module to the Nuxt config
export default defineNuxtConfig({
modules: [
'@e-chan1007/nuxt-firebase'
],
firebase: {
}
})
- Use in your pages, components or server routes
<template>
<p>Hello {{ currentUser?.displayName }}!</p>
</template>
<script lang="ts" setup>
const { currentUser } = useAuth();
</script>
Development
- Run
npm run dev:prepare
to generate type stubs. - Use
npm run dev
to start playground in development mode.