Dear Team,
This is a vite react App. https://weatherapp3-gem8.onrender.com/
I get 404 when I tried to access the /favorites ending url, directly from a new Tab.
I checked in the browser and I didn’t got any html file in the network field.
I added to my packege.json a “start”: “http-server dist -s”,
my package.json:
{
“name”: “weatherapp”,
“private”: true,
“version”: “0.0.0”,
“type”: “module”,
“scripts”: {
“dev”: “vite”,
“build”: “yarn install && vite build”,
“start”: “http-server dist -s”,
“lint”: “eslint . --ext js,jsx --report-unused-disable-directives --max-warnings 0”,
“preview”: “vite preview”
},
“dependencies”: {
“@babel/core”: “^7.24.5”,
“@reduxjs/toolkit”: “^1.9.7”,
“dotenv”: “^16.3.1”,
“react”: “^18.2.0”,
“react-dom”: “^18.2.0”,
“react-icons”: “^5.2.1”,
“react-is”: “^18.3.1”,
“react-redux”: “^8.1.3”,
“react-router-dom”: “^6.20.1”,
“styled-components”: “^6.1.1”
},
“devDependencies”: {
“@types/react”: “^18.2.37”,
“@types/react-dom”: “^18.2.15”,
“@vitejs/plugin-react”: “^4.2.0”,
“eslint”: “^8.53.0”,
“eslint-plugin-react”: “^7.33.2”,
“eslint-plugin-react-hooks”: “^4.6.0”,
“eslint-plugin-react-refresh”: “^0.4.4”,
“http-server”: “^14.1.1”,
“vite”: “^5.0.0”
},
“resolutions”: {
“styled-components”: “^5”
}
}
my render.yaml
services:
- type: web
name: weatherapp
env: node
plan: free
buildCommand: yarn install && yarn build
startCommand: yarn start
staticPublishPath: dist
routes:- type: rewrite
source: /favorites
destination: /index.html - type: rewrite
source: /.*
destination: /index.html
- type: rewrite
I did ‘yarn build’ before the deployement
i checked in my index.html if I can access both src and href ur and I can:
<script type="module" crossorigin src="./assets/index-Dm8JhGJ5.js"></script>
<link rel="stylesheet" crossorigin href="./assets/index-BoObjiJv.css">
Please see attachments
BR, Tal