Any tips for converting an existing repo into a React app? You can’t run
npx create-react-app in an existing project. I’ve attempted to copy paste the guts from a clean install using
create-react-app but getting the following errors…
Uncaught SyntaxError: Unexpected token ‘<’
0.chunk.js:1 Uncaught SyntaxError: Unexpected token ‘<’
main.chunk.js:1 Uncaught SyntaxError: Unexpected token ‘<’
main.0e8d68239a1a70a22f0e.hot-update.js:1 Uncaught SyntaxError: Unexpected token ‘<’
inpage.js:1 HEAD http://localhost:3000/jermay/crypto-kittie/favicon.ico/ net::ERR_ABORTED 404 (Not Found)
a @ inpage.js:1
s @ inpage.js:1
(anonymous) @ inpage.js:1
sendSiteMetadata @ inpage.js:1
e @ inpage.js:1
manifest.json:1 Manifest: Line: 1, column: 1, Syntax error.
I’ve created a branch “react” for this. You can see the original version using jQuery in the “master branch”.
UPDATE: I got it to load! The issue was in my
package.json. There was a “homepage” property and this changed the url react used to host the page to
/localhost:3000/jermay/crypto-kittie this was messing up the url path to the generated script files “main.js”, “bundle.js”, manifest, etc. Now its served from just
localhost:3000 and it loads!
But yah, tips for converting existing apps to React still welcome. I couldn’t find many relevant articles or videos for converting existing projects to full blown React apps.