3

I'm trying to deploy my app to firebase hosting and I'm getting this error in the console Uncaught SyntaxError: Unexpected token '<' in several *.chunk.js files. I have already deployed my app to gh-pages and everything has worked just fine. Also I have tried to deploy it to netlify hosting but I had Failed to load resource: the server responded with a status of 404 () in all *.js files. Here is my 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"}]}
    ]
  }
}

For some reason these *.chunk.js files contain some html code image from the console But at the same time my local main.chunk.js does not image of local file

4
  • The problem is not with the Firebase Hosting configuration you're showing here. It's with the content that you deployed. Commented Aug 16, 2020 at 16:52
  • But how is it working on gh-pages then? What might be the difference between them? Commented Aug 16, 2020 at 16:57
  • If you have more information to share about your observations, I suggest editing the question to include everything. Without specific source code and steps to take to reproduce the problem, I don't think there's much we can do. Commented Aug 16, 2020 at 17:01
  • Added link to broken firebase app and screenshots of main.chunk.js. Thanks for advise Commented Aug 16, 2020 at 17:09

1 Answer 1

4

Apparently, I had a conflict in my package.json file. Necessary for gh-pages "homepage": ... in package.json was somehow messing up with deployments to other hosting providers.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.