Preact: SyntaxError: expected expression, got '<'

Created on 3 Jan 2018  路  4Comments  路  Source: preactjs/preact

Hi,

Sometimes I'm getting this log with the blank page after page refresh

SyntaxError: expected expression, got '<'

Where I'm doing something wrong? Any idea?

screen shot 2018-01-03 at 14 26 48

invalid question

Most helpful comment

You're missing a JSX transformation (such as Babel's), resulting in the browser attempting to parse JSX (which is not supported).

Just a note - this seems more like a preact-cli issue than a Preact issue.

All 4 comments

That sometimes happens when your server is returning an HTML page instead of the JS files. Can you try to look at the contents of the files when you get the error?

I couldn't understand from the compressed js file.
However I have not seen this message in the last couple hours.

I've done 3 things;
added defer attribute to all js files.
cleared service worker pwa caches from the browser.
cleared all browser caches.

I keep on testing

You're missing a JSX transformation (such as Babel's), resulting in the browser attempting to parse JSX (which is not supported).

Just a note - this seems more like a preact-cli issue than a Preact issue.

Hi,

Sometimes I'm getting this log with the blank page after page refresh

SyntaxError: expected expression, got '<'

Where I'm doing something wrong? Any idea?

screen shot 2018-01-03 at 14 26 48

**

**I got same error in my React project. It fixed while I put my external jQuery files and CSS files to puplic folder and Images in src folder

include script in public/index.html like below and put jquery-1.12.4.min.js file inside puplic/assets/etc,
**

**

Was this page helpful?
0 / 5 - 0 ratings