Giter Site home page Giter Site logo

Comments (3)

yusinto avatar yusinto commented on June 3, 2024

The LaunchDarkly JS 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.

This is also covered in our v2 to v3 migration docs. Read more here.

from js-client-sdk.

tylerexmg avatar tylerexmg commented on June 3, 2024

Hi @yusinto thank you for your reply. We are using Webpack 5 "webpack": "^5.73.0" and also use optional chaining in our code without issue when reverting to the LD JS SDK v2.

from js-client-sdk.

yusinto avatar yusinto commented on June 3, 2024

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

from js-client-sdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.