diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 22af683..3a73144 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -51,10 +51,12 @@ jobs: with: name: github-pages path: build # The folder containing your build output - - # Step 5: Deploy to GitHub Pages + #When React builds the app, it generates relative paths based on the homepage field. Without this field, the paths default to /, causing errors when served from a subpath like /repository-name. + #Set the homepage Field in package.json + #React assumes it is being served from the root of the domain (/), but GitHub Pages serves the app from a subpath like /repository-name. + # Step 5: Deploy to GitHub Pages - name: Deploy to GitHub Pages uses: actions/deploy-pages@v4 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Automatically provided by GitHub - publish_dir: build + diff --git a/package.json b/package.json index db6f325..109208b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,7 @@ { "name": "my-typescript", "version": "0.1.0", + "homepage": "https://sanjeetkumaritoutlook.github.io/react-local-stenciljs", "private": true, "dependencies": { "@testing-library/jest-dom": "^5.16.5",