Spaces:
Running
Running
| 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. | |