|
| 1 | +# Integrate Vite |
| 2 | + |
| 3 | +Using the Firebase CLI, you can deploy your Vite-powered sites to Firebase |
| 4 | +and serve them with Firebase Hosting. The following instructions also apply |
| 5 | +to React, Preact, Lit, and Svelte as they are built on the Vite integration. |
| 6 | + |
| 7 | +Note: Framework-aware Hosting is an early public preview. This means |
| 8 | +that the functionality might change in backward-incompatible ways. A preview |
| 9 | +release is not subject to any SLA or deprecation policy and may receive limited |
| 10 | +or no support. |
| 11 | + |
| 12 | +## Before you begin |
| 13 | + |
| 14 | +Before you get started deploying your app to Firebase, |
| 15 | +review the following requirements and options: |
| 16 | + |
| 17 | +- Firebase CLI version 12.1.0 or later. Make sure to |
| 18 | + [install the CLI](https://firebase.google.com/docs/cli#install_the_firebase_cli) using your preferred |
| 19 | + method. |
| 20 | +- Optional: An existing Vite project. You can create one with |
| 21 | + `npm create vite@latest` or let the Firebase CLI |
| 22 | + initialize a new project for you. |
| 23 | + |
| 24 | + |
| 25 | +## Initialize Firebase |
| 26 | + |
| 27 | +To get started, initialize Firebase for your framework project. |
| 28 | +Use the Firebase CLI for a new project, or modify `firebase.json` for an |
| 29 | +existing project. |
| 30 | + |
| 31 | +### Initialize a new project |
| 32 | + |
| 33 | +1. In the Firebase CLI, enable the web frameworks preview: |
| 34 | + <pre class="devsite-terminal">firebase experiments:enable webframeworks</pre> |
| 35 | +1. Run the initialization command from the CLI and then follow the prompts: |
| 36 | + <pre class="devsite-terminal">firebase init hosting</pre> |
| 37 | +1. Answer yes to "Do you want to use a web framework? (experimental)" |
| 38 | +1. Choose your hosting source directory. If there is an existing Vite codebase, |
| 39 | + the CLI detects it and the process completes. |
| 40 | + |
| 41 | +## Serve static content |
| 42 | + |
| 43 | +After initializing Firebase, you can serve static content with the standard |
| 44 | +deployment command: |
| 45 | + |
| 46 | +```shell |
| 47 | +firebase deploy |
| 48 | +``` |
| 49 | + |
| 50 | +You can [view your deployed app](https://firebase.google.com/docs/hosting/test-preview-deploy#view-changes) |
| 51 | +on its live site. |
0 commit comments