Uncaught SyntaxError: Unexpected token '<' while deploying create react app to firebase hosting
Uncaught SyntaxError: Unexpected token '<' while deploying create react app to firebase hosting
我正在尝试将我的应用程序部署到 firebase 托管,但我在多个 *.chunk.js
文件的控制台 Uncaught SyntaxError: Unexpected token '<'
中收到此错误。我已经部署了 my app to gh-pages 并且一切正常。我也尝试将它部署到 netlify 托管,但我在所有 *.js 文件中都有 Failed to load resource: the server responded with a status of 404 ()
。
这是我的 firebase.json
:
{
"hosting": {
"public": "build",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
],
"headers": [
{"source": "/service-worker.js", "headers": [{"key": "Cache-Control", "value": "no-cache"}]}
]
}
}
出于某种原因,这些 *.chunk.js
文件包含一些 html 代码
image from the console
但同时我的本地 main.chunk.js
没有
image of local file
显然,我的 package.json
文件中存在冲突。 gh-pages
"homepage": ...
在 package.json
中的必要性以某种方式搞乱了对其他托管服务提供商的部署。
我正在尝试将我的应用程序部署到 firebase 托管,但我在多个 *.chunk.js
文件的控制台 Uncaught SyntaxError: Unexpected token '<'
中收到此错误。我已经部署了 my app to gh-pages 并且一切正常。我也尝试将它部署到 netlify 托管,但我在所有 *.js 文件中都有 Failed to load resource: the server responded with a status of 404 ()
。
这是我的 firebase.json
:
{
"hosting": {
"public": "build",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
],
"headers": [
{"source": "/service-worker.js", "headers": [{"key": "Cache-Control", "value": "no-cache"}]}
]
}
}
出于某种原因,这些 *.chunk.js
文件包含一些 html 代码
image from the console
但同时我的本地 main.chunk.js
没有
image of local file
显然,我的 package.json
文件中存在冲突。 gh-pages
"homepage": ...
在 package.json
中的必要性以某种方式搞乱了对其他托管服务提供商的部署。