ga-lite icon indicating copy to clipboard operation
ga-lite copied to clipboard

SyntaxError Unexpected token =

Open sarahsturgeon opened this issue 3 years ago • 2 comments

Hi, I'm getting this error very frequently from visitors.

We have to support a super old verison of chromium, so I imagine it's just not working for something that old. Worth noting, though, that we've used ga-lite for years and it definitely used to work 🤷

We're on 2.1.6, hosted here: https://loading.cfcservers.org/assets/js/ga-lite.min.js

If I run that code through JSLint it throws the same error.

If I make this change:

-!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof 
+!function(e,t){"object"==typeof exports&&"object"==typeof module?(module.exports=t()):"function"==typeof 

It doesn't fail there anymore, but there's another one shortly that throws an error. I made it up to character 1,000 before I gave up - there's gotta be an easier way.

If this is just syntax, is there some way I can make this load on older browsers?

sarahsturgeon avatar May 07 '22 03:05 sarahsturgeon

Hey, thank you for opening the issue!

Do you have any specifics on how old Chromium you're supporting? This project uses Babel, which I think can be configured to support arbitrary old browsers at least all the way down to ES5 via browserslist.

jehna avatar May 16 '22 18:05 jehna

It's a modified version of Chromium so it's hard to point at a specific version, but roughly v11?

The issue doesn't even seem to be new features or anything, just weird syntax issues. So far, just requiring more parens around some ternaries and such - which would definitely still be compatible with newer browsers.

sarahsturgeon avatar May 16 '22 21:05 sarahsturgeon