Skip to content
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

Launch darkly version 3+ crashes older browsers #182

Closed
gregdolby opened this issue Feb 2, 2023 · 3 comments
Closed

Launch darkly version 3+ crashes older browsers #182

gregdolby opened this issue Feb 2, 2023 · 3 comments

Comments

@gregdolby
Copy link

Describe the bug
Launch darkly version 3+ crashes chrome browser's version 79 or lower. I noticed this when trying to run a web app on Samsung Tizen TV because they use older browsers. Then I was able to reproduce in an older version of Chrome using BrowserStack

To reproduce
Load an app on chrome browser 79 or lower (I used browserstack)

Expected behavior
I expect it to load properly on older browsers

Logs
Screen Shot 2023-02-01 at 2 07 07 PM

SDK version
3.1.0

Language version, developer tools
Node v16.8.0
npm 7.21.0

OS/platform
chrome 79
macOS Monterey 12.6.3

@yusinto
Copy link
Contributor

yusinto commented Feb 2, 2023

The React SDK v3.0 and up uses optional chaining which is supported by modern browsers. It looks like you bundle your react app using webpack. The issue is webpack 4 uses a version of acorn which does not transpile the optional chaining operator. The solution as you can see in the react async provider example is to resolve the acorn package version that does support it. To do this, in your package.json file:

  "resolutions": {
    "acorn": "npm:acorn-with-stage3"
  }

Webpack 5 supports optional chaining out of the box so we recommend you upgrade to that if possible. If you use other bundlers, make sure to enable/include plugins for optional chaining for your bundler.

@yauheniivashkevich
Copy link

I have the same issue when run jest test
adding resolutions don't help to fix that

@yusinto
Copy link
Contributor

yusinto commented Feb 27, 2023

This should be fixed in 3.0.2. We have removed the optional chaining operator so please update to that version if you have issues with the ? operator.

@yusinto yusinto closed this as completed Feb 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants