-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How I resolve SyntaxError: expected expression, got '<' #81
Comments
have the same issue on chrome 61 for android (but not on desktop)! |
same problem happened to me, but worked fine on a localhost server |
are using service workers ? |
**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, <script src="assets/js/vendor/jquery-1.12.4.min.js"></script>** |
Description
Have been dealing with the evil
SyntaxError: expected expression, got '<'
on Firefox in the last couple of days and had totally no idea what had been gone wrong. Everything worked fine and great on Chrome 55, Opera 41, Safari 10 but not FF 50+.***Update: This error
SyntaxError: expected expression, got '<'
is most likely to happen when Service Workers is enabled and working fine on the browser. Since Service Worker in SPA will re-route basically anything that is not found to/index.html
(according to default configuration) and so it does the same for.js
. That's why whenapp-indexeddb-mirror
is looking for its.js
files Service Worker couldn't find it and just routed it to/index.html
which then causedSyntaxError
. In order to resolve that, we have to deliberately tell Service Worker to cache all the.js
files withinapp-indexeddb-mirror
like the following:***Additional step for Firefox: Head over to
about:debugging#workers
in Firefox and unregister all service workers. Clear your offline storage in FF. Do a page refresh and boom!!! Everything works as expected without throwing SyntaxError anymore. Hope this will help those struggling with the evil SyntaxError. 😄Expected outcome
app-indexeddb-mirror
caches all JSONs from Firebase for offline use on all modern browsers.Actual outcome
FF50+ suffers from
SyntaxError: expected expression, got '<'
.Live Demo
N/A
Steps to reproduce
Browsers Affected
The text was updated successfully, but these errors were encountered: