-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7383287
commit 0e2eaf2
Showing
1 changed file
with
89 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,92 @@ | ||
# React + Vite | ||
# Simple Vite.js React App | ||
|
||
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules. | ||
Welcome to your new Vite.js React app, which is ready to be deployed on GitHub Pages! This README will guide you through using this repository and deploying your web application so you can share it with the world. | ||
|
||
Currently, two official plugins are available: | ||
## Prerequisites | ||
|
||
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh | ||
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh | ||
Before you start, make sure you have the following installed: | ||
- [Node.js](https://nodejs.org/): This is necessary to run the project and includes npm (Node Package Manager) which we'll use to manage the project's dependencies. | ||
- [Git](https://git-scm.com/): Version control system to manage the source code of your application. | ||
|
||
## Getting Started | ||
|
||
First, clone this repository to get a local copy on your computer. Open your terminal, and run: | ||
|
||
```bash | ||
git clone git@github.com:Very-Good-Apps-LLC/verygoodapps.co.git | ||
cd verygoodapps.co | ||
``` | ||
|
||
Then, install the dependencies by running: | ||
|
||
```bash | ||
npm install | ||
``` | ||
|
||
This command fetches all the necessary packages required to run and build your React application. | ||
|
||
## Running Locally | ||
|
||
To start the development server and view your application in the browser, run: | ||
|
||
```bash | ||
npm run dev | ||
``` | ||
|
||
This command starts a local development server provided by Vite.js and opens up your browser to `http://localhost:5173` where your app is running. The server provides hot reloading, so changes you make in the code will automatically refresh the page. | ||
|
||
## Structure of the Repository | ||
|
||
- `src/`: This directory contains all your React components and your main application logic. | ||
- `index.html`: The entry point for your web application. | ||
- `vite.config.js`: Configuration file for Vite.js, which includes settings for the development and production builds. | ||
|
||
## Deploying to GitHub Pages | ||
|
||
To deploy your app to GitHub Pages, you'll use the `gh-pages` plugin, which automates the process of publishing the files generated during the build to the `gh-pages` branch of your repository. | ||
|
||
Deploy the build to GitHub Pages: | ||
|
||
```bash | ||
npm run deploy | ||
``` | ||
|
||
This command runs a script that the `gh-pages` plugin uses to push the contents of the `dist/` directory to the `gh-pages` branch of your GitHub repository. | ||
|
||
After running the deploy command, your application will be available at `https://your-username.github.io/your-repo-name/`. | ||
|
||
## Common Issues and Troubleshooting | ||
|
||
As you work with your Vite.js React application, you might encounter some issues, especially when it comes to deployment. Here are a few common problems and how to resolve them: | ||
|
||
### 1. **Page Not Found on GitHub Pages** | ||
|
||
**Problem:** After deploying, you see a "404 Page Not Found" error when you visit your GitHub Pages URL. | ||
|
||
**Solution:** This usually happens if the `base` configuration in `vite.config.js` is not set correctly. Ensure that it matches the repository name with a leading slash and trailing slash. For example: | ||
|
||
```javascript | ||
export default defineConfig({ | ||
base: '/your-repo-name/', | ||
plugins: [react()] | ||
}) | ||
``` | ||
|
||
### 2. **Changes Not Reflecting After Deployment** | ||
|
||
**Problem:** You've deployed your application, but the changes are not visible on GitHub Pages. | ||
|
||
**Solution:** This might be due to browser caching or a delay in GitHub Pages updating. First, try clearing your browser's cache and reloading the page. If that doesn’t work, ensure that the `gh-pages` branch in your repository contains the latest build. | ||
|
||
### 3. **Build or Deployment Fails** | ||
|
||
**Problem:** The `npm run deploy` command fails with an error message in the terminal. | ||
|
||
**Solution:** Check the error message provided in the terminal for clues. Common issues include: | ||
|
||
- **Dependency issues:** Run `npm install` to make sure all dependencies are correctly installed. | ||
- **Configuration errors:** Verify that there are no syntax errors in `vite.config.js`. | ||
|
||
## Need Help? | ||
|
||
If you encounter any issues or have questions about the process, consider looking through the [Vite.js documentation](https://vitejs.dev/guide/) and the [React documentation](https://reactjs.org/docs/getting-started.html). |