-
Notifications
You must be signed in to change notification settings - Fork 133
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
Syntax Error Unexpected token '.' in some browser #604
Comments
Hi @ngoctuan001 It's more like a feature request since this syntax has more than 90% browsers supported It's already put into our backlog. No ETA right now but we will keep you updated. |
Hi @ngoctuan001, which browser are you using and which version is it? |
Hi @Mercy811 Chrome 78 (windows), Chrome mobile ios 92 (ios12), mobile safari 13 (ios13), chrome 78 (windows 10), chrome mobile 78 ( android 11), uc browser 15 (android10), mobile safari 12( ios12) |
i also found another existing thread reported this issue long time ago, it seems it has this issue from version 8.21.4 90% coverage of browser syntax actually not very high 😂 , considering this is a quite popular library, we hope this can be fixed soon 🙏 |
Hi @ngoctuan001, unfortunately we don't have a plan to support older versions of browsers. Please upgrade to newer version. |
Hi @ngoctuan001, our latest typescript browser SDK conforms to ES5 which covers 97.75% users. Hope the migration guide helps. |
@Mercy811 The optional chaining operator is ES2020. Just wanted to confirm before upgrading... the new SDK is ES5, even though the old SDK was ES2020? |
"Uncaught SyntaxError: Unexpected token .", |
In the built files of amplitude, the code doesn't transpile the '?.' and '??' syntax.
When we tried to use the files, it reports error in some browser which doesn't understand this syntax in javascript context.
Suggested solutions:
in your rollup config, add
'@babel/plugin-proposal-optional-chaining'
For example:
Note: we found out this
?.
may come from a node_modules, that why in the suggested solution above, i comment out the exclude part so that the built file will no longer have?.
If you guys have any other ideas, can help contribute too, thanks
Environment
The text was updated successfully, but these errors were encountered: