Spaces:
Running
Running
File size: 1,174 Bytes
83f6511 303a85e 83f6511 b26246b b70a3e1 b26246b b70a3e1 b26246b b70a3e1 b26246b b70a3e1 b26246b b70a3e1 b26246b b70a3e1 b26246b b70a3e1 b26246b b70a3e1 b26246b b70a3e1 b26246b b70a3e1 b26246b b70a3e1 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | ---
title: Optimization
emoji: 🚀
colorFrom: purple
colorTo: indigo
sdk: static
app_file: dist/index.html
pinned: false
---
# Developer's Guide for React frontend
## Prerequisites
Install **Node.js** if not done yet. The following commands should run if you have it installed.
```bash
node -v
npm -v
```
## Local Development
First go to the react frontend folder:
```bash
cd frontends/react
```
Run the following commands to install required packages when you run the code the first time or after you make changes to `package.json`.
```bash
npm install
```
Now you should be able to start the local development server:
```bash
npm run dev
```
Open the link printed out on the terminal. The webpage automatically reloads when files are edited.
## Deploy to Hugging Face
### Build the production version:
```bash
npm run build
```
This generates the production build inside the `dist/` directory.
### Commit and push:
```bash
git add <files>
git commit
git push
```
⚠️ Make sure the `dist/` directory is included when adding to git.
⚠️ Even if you only changed the backend, you must still run `npm run build` when deploying or it will not update.
|