Hi @Ravi Praneeth
As seen above, the error occurred because the package.json
file does not have the correct configuration to route the application properly.
Your React app was built for the root path (/
), but you were serving it from a subpath (/bakery/
) via Azure Front Door. Because of this mismatch, the browser tried to load static assets like.
/bakery/css/bootstrap.css
/bakery/static/js/main.js
To resolve this issue, update the package.Json
file with the following entry:
"homepage": "/bakery"
Here is the update package.Json file
{
"name": "landingpage-react-template",
"private": true,
"homepage": "/bakery",
"dependencies": {
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.3.2",
"@testing-library/user-event": "^7.1.2",
"emailjs-com": "^2.6.4",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-helmet": "^6.1.0",
"react-scripts": "^5.0.1",
"smooth-scroll": "^16.1.3"
},
"scripts": {
"start": "react-scripts start",
"build": "CI=false react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
After updating the code and rebuilding the app, it loads properly, as shown below
I hope this helps to resolve your query.
If the above is unclear and/or you are unsure about something, add a comment below.
Please don’t forget to close the thread by clicking "Accept the answer" wherever the information provided helps you, as this can be beneficial to other community members