Creating a basic app using create-react-app
works fine using npm start
but once I moved it over to firebase serve
I get
Uncaught SyntaxError: Unexpected token <
I followed all the instructions and muy firebase.json
looks good, as well as my .firebaserc
{
"name": "www",
"version": "0.1.0",
"private": true,
"homepage": "https://www.gitlab.io/",
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject",
"precommit": "lint-staged"
},
"lint-staged": {
"linters": {
"src/**/*.js": [
"prettier-standard",
"git add"
]
}
},
"dependencies": {
"react": "^16.2.0",
"react-dom": "^16.2.0",
"react-scripts": "1.0.12",
"styled-components": "^3.1.6"
},
"devDependencies": {
"husky": "^0.14.3",
"lint-staged": "^6.1.0",
"prettier-standard": "^8.0.0"
}
}
After hours of trying to debug (and creating a vanilla react app from scratch), I tried using an earlier version of react, specifically 16.0.0
instead of 16.2.0
. That alone allowed the rendered page using firebase serve
to work properly.
Hopefully this helps some poor soul save a few hours of chasing their tail.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.