syntax error: uncaught error : unexpected token <
_redirects
/* /index.html 200!
packagae.json
"scripts" : {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
}
If you are going to put a _redirects
into your create react app
, it should go into the public
folder. The build folder should not be in your repository for continuous build solutions like Netlify.
The _redirects
you suggest here are typically used for when you use single page apps with a router like react router and want a path to always go to index.html
when it does not exist. You would not want it to resolve asset value paths.
This redirect rule will serve the index.html instead of giving a 404 no matter what URL the browser requests.
_redirects
/* /index.html 200
What is happening is you are forcing the index.html page to serve up even if there is not a valid path, which is happening with your assets.
_redirects
to public
folder!
from the end of the redirects, so if a path is found it serves it correctly and not always forcing it to index.html