0

i'm trying to deploy my react app through firebase but after deploying i get a blank page and the SyntaxError: expected expression, got '<'. i think this is because it's reading the < from html but i'm not sure how to solve this. below is the index.html form my build folder which is initialized as the source for firebase

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no">
    <meta name="theme-color" content="#000000">
    <link href="../src/App.css" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css?family=Merriweather:900" rel="stylesheet">
    <link rel="manifest" href="/CV/manifest.json">
    <link rel="shortcut icon" href="/CV/favicon.ico">
    <title>Lorenzo Wijtman</title>
    <link href="/CV/static/css/main.1b15713e.css" rel="stylesheet">
</head>

<body>
    <noscript>You need to enable JavaScript to run this app.</noscript>
    <div id="root"></div>
    <script type="text/javascript" src="/CV/static/js/main.1b785adb.js"></script>
</body>

</html>

my firebase.json content below

{
  "hosting": {
    "public": "build",
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**"
    ],
    "rewrites": [
      {
        "source": "**",
        "destination": "/index.html"
      }
    ]
  }
}
10
  • Could you share your firebase url where you deploye Commented Jun 2, 2018 at 16:49
  • apologies, this is the url lorenzo-wijtman.firebaseapp.com Commented Jun 2, 2018 at 16:52
  • This is because route rewrite. Your all route request goes to index.html whatever it's javascript or css. You need to fix this in firebase deploy configuration. Commented Jun 2, 2018 at 16:55
  • thank you for the reply, but what exactly do i need to change in the deploy configuration? Commented Jun 2, 2018 at 17:04
  • Could you share your firebase.json file content Commented Jun 2, 2018 at 17:06

1 Answer 1

1

Your HTML contains this script include:

<script type="text/javascript" src="/CV/static/js/main.30b4dcd1.js"></script>

If you try to load this URL, you will see that you're getting back your original HTML, instead of a JavaScript file. Since you told the browser to expect JavaScript, it is complaining about the angular brackets.

It looks like you're not deploying a /CV/static/js/main.30b4dcd1.js. Since you're telling Firebase Hosting to rewrite everything to /index.html, that's what it does when there is no matching file for a URL.

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.