Forum Support

Shape 5
March 29, 2024, 08:42:56 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Shape 5 Forum
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Uncaught SyntaxError: Unexpected token < in chrome  (Read 1516 times)
shawnmcgin
Jr. Member
**
Offline Offline

Posts: 9



« on: February 15, 2018, 11:29:34 PM »

I would like to use Enable JS Compression to try and squeeze some performance out of my site but when enabled it's even slower due to the error "Uncaught SyntaxError: Unexpected token <" in Chrome.  Works fine in FireFox.  Any ideas?  Hopefully a simple fix.  Running on J! 3.7.5
Logged
mikek
Administrator
*****
Offline Offline

Posts: 28743



WWW
« Reply #1 on: February 16, 2018, 08:50:11 AM »

Hello,

An error message would not cause the site to run slower, it's just an error on the page. Please post a url to your site.
Logged

Mike Knott
------------
Shape 5 Team

- Need a great host for your website? We highly recommend siteground.com!


- Put your trust in the hands of our extremely qualified staff to get your job done right!


- Firebug is the most powerful web development and debugging tool, and it will save you a lot of time, frustration and forum questions:
Install Firebug
shawnmcgin
Jr. Member
**
Offline Offline

Posts: 9



« Reply #2 on: February 16, 2018, 02:12:27 PM »

This is my dev site.  In chrome dev tools you will see the error:
http://runstuff.hopto.org/en/licensure-in-new-brunswick/physician-assistants
Logged
mikek
Administrator
*****
Offline Offline

Posts: 28743



WWW
« Reply #3 on: February 19, 2018, 08:13:36 AM »

Hello,

That is referring to a core Joomla js file:

Uncaught SyntaxError: Unexpected token <
jquery-migrate.min.js?a52d0b7386d77a380579088bbccdfdcf:2 JQMIGRATE: Migrate is installed, version 1.4.1

The template does not have any control over that file and the compression tool does not either - it only compresses template related files.

Everything on your site seems to be working fine, I don't think I would worry about this, especially since there are no errors in other browsers.
Logged

Mike Knott
------------
Shape 5 Team

- Need a great host for your website? We highly recommend siteground.com!


- Put your trust in the hands of our extremely qualified staff to get your job done right!


- Firebug is the most powerful web development and debugging tool, and it will save you a lot of time, frustration and forum questions:
Install Firebug
shawnmcgin
Jr. Member
**
Offline Offline

Posts: 9



« Reply #4 on: February 19, 2018, 01:50:17 PM »

I don't believe that file is the issue.  If you look at the error in dev tools the error itself is not referenced in that file.
And no I cannot ignore the error. You state here "The template does not have any control over that file and the compression tool does not either - it only compresses template related files. ".. ok so then let's not assume the issue is that file as I believe that file is loading fine.  When I disable JS Compression the error goes away, when I re-enable JS Compression is when I see the error so it's definitely related to the shape5 tool.  Can you please try to replicate in your local dev, I assume you manage dev of your templating tools.  Also I'm using Chrome on Mac Version 63.0.3239.132 (Official Build) (64-bit)
Also have a look at how you're managing compressed JS from php (ie. top_compression_js.php/bottom_compression_js.php/etc..) I'm not sure about it but I think this may be related to how you render js from php in relation to chrome rules.

Shawn
Logged
mikek
Administrator
*****
Offline Offline

Posts: 28743



WWW
« Reply #5 on: February 20, 2018, 08:48:22 AM »

Hello,

"I don't believe that file is the issue.  If you look at the error in dev tools the error itself is not referenced in that file."

I don't know what you mean, the error message specifically states that the error is from that file, it cannot name a wrong file:

Uncaught SyntaxError: Unexpected token <
jquery-migrate.min.js?a52d0b7386d77a380579088bbccdfdcf:2 JQMIGRATE: Migrate is installed, version 1.4.1

As I stated above the template has absolutely no control over this file. The template only effects files within the template js and css folders. It has no way to touch core files or third party files.

I have just tested a fresh installation with compression enabled and there are no javascript error messages at all in Chrome. See attached. With your site showing the error that would indicate that something has either been modified on your site or there's a third party extension that is interfering. I would suggest disabling all third party extensions, and see if one is causing the problem. You can also try patching Vertex to the latest files to make sure you have all the latest files or you can override the template's index.php file with a fresh on from the template's download section, in case something has been modified.

Or as I stated above the error message is not causing any issues on your site as is and you can just leave it. Or you can leave the js compression off, the template's js files are not that large, they are also already minified, and caching them will not effect site performance all that much, if at all.
Logged

Mike Knott
------------
Shape 5 Team

- Need a great host for your website? We highly recommend siteground.com!


- Put your trust in the hands of our extremely qualified staff to get your job done right!


- Firebug is the most powerful web development and debugging tool, and it will save you a lot of time, frustration and forum questions:
Install Firebug
shawnmcgin
Jr. Member
**
Offline Offline

Posts: 9



« Reply #6 on: February 21, 2018, 06:31:54 PM »

I don't know what you mean, the error message specifically states that the error is from that file, it cannot name a wrong file:

No it doesn't state the error is in that file.  That's just console logging from the jquery migrate minified js.  See https://forum.joomla.org/viewtopic.php?t=928872
If I mute the output from that script, which I tried, it doesn't display the message.  See attached.

Therefore your comment is rendered moot - "As I stated above the template has absolutely no control over this file. The template only effects files within the template js and css folders. It has no way to touch core files or third party files. " - as I am not making any assumption that it has anything to do with that jquery file.  

I do agree, according to your documentation your tools do not touch core files but there is an error and it has a negative impact on this site.  For example, when I enable compression is messes up the fonts on the homepage (see images) .. and looking at the output in the dev tools it looks like my custom css/js may not be loading.  Is it the case that when I enable compression any custom.css/custom.js is no longer included?  Maybe this is where the root of the problem is or is custom.css/custom.js minified and moved into top_compression_xx?

I'm going to try your suggestion to see if patching vertex will fix it.  And I'll try disabling 3rd party extensions.  I understand you don't feel there is a negative impact but as stated there are issues and I'm struggling with performance on the backend of my site because I'm limited to caching design elements as I cannot cache the content so it's somewhat imperative that I find a solution to this.

Thanks
Shawn



« Last Edit: February 21, 2018, 06:38:17 PM by shawnmcgin » Logged
shawnmcgin
Jr. Member
**
Offline Offline

Posts: 9



« Reply #7 on: February 21, 2018, 06:33:08 PM »

posting multiple images
« Last Edit: February 21, 2018, 06:35:42 PM by shawnmcgin » Logged
shawnmcgin
Jr. Member
**
Offline Offline

Posts: 9



« Reply #8 on: February 21, 2018, 06:56:32 PM »

I updated Vertex still same issue.
I also disabled all modules except S5 modules and still no luck.
Do you have any other suggestions? Do I need to disable plugins as well?  And please let me know about the custom css/js if I need to do something to ensure they are included when compression is turned on.

Thanks
Shawn
Logged
mikek
Administrator
*****
Offline Offline

Posts: 28743



WWW
« Reply #9 on: February 22, 2018, 09:30:57 AM »

Hello,

"Do I need to disable plugins as well? "

---Yes, all third party products.

custom.js

---There is no such file in our template. Have you added javascript or modified existing javascript?

"I do agree, according to your documentation your tools do not touch core files but there is an error and it has a negative impact on this site.  For example, when I enable compression is messes up the fonts on the homepage (see images)"

---To be clear, what is shown in Chrome, and no other browser, is a javascript error. That will not effect css elements on the page. They are different files altogether.

custom.css

---This is included in the compression. If it's not being included after you enable compression then there is one of two issues: 1. You did not clear the cache files from the first time compression was enabled. By not clearing them you are continually loading the original cache file which would not included any updates. You need to delete the files in the template's cache folder. 2. You have a syntax error in your css that is causing the css to break.

"I understand you don't feel there is a negative impact but as stated there are issues and I'm struggling with performance on the backend of my site because I'm limited to caching design elements as I cannot cache the content so it's somewhat imperative that I find a solution to this."

---This compression will not effect any part of the backend of the site. This only handles frontend files that are called through the template. If you are having performance issues I would suggest contacting your host. As I stated above, adding compression of css and js files will add almost no noticeable difference, if any at all. All it really does it reduce the number of header requests, which rarely effects site performance. Also, this compression doesn't cache content, it only compresses template js and css files. I am only saying this because you seem concerned about site performance, and I am telling that you even if we get this error gone it will have almost no effect on your site. You need to look into server performance issues and caching directly through the server (most servers offer this).



If you have disabled all third party extensions and have reverted all modifications done to the template and the message still appears please private message me super admin access and ftp access so I can debug this further.
« Last Edit: February 22, 2018, 09:34:17 AM by mikek » Logged

Mike Knott
------------
Shape 5 Team

- Need a great host for your website? We highly recommend siteground.com!


- Put your trust in the hands of our extremely qualified staff to get your job done right!


- Firebug is the most powerful web development and debugging tool, and it will save you a lot of time, frustration and forum questions:
Install Firebug
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF | SMF © 2013, Simple Machines
Joomla Bridge by JoomlaHacks.com
Valid XHTML 1.0! Valid CSS!
Looking for the largest variety in template designs? Look no more. Never buy 1 theme again. Signups start at just $89 for access to all of our themes.
Send Us An Email
Please send us your questions and we will email you back as soon as we can. Product support questions should be posted in our support forums under the Help menu. Our staff will assist you from there.