Closed rrawat-dev closed 4 months ago
Hello @rrawat-dev,
Is this a new issue you are encountering with a SDK version update, or is this a new implementation?
Thank you, Ryan
Also, to clarify, what specific version of webpack are you using?
Hi Ryan,
Integrating LaunchDarkly first time with an existing project setup (Webpack ^2.2.1).
Thank you @rrawat-dev. I will see if I can get it working with that version, but it is likely there will be problems as that webpack version was released 7 years ago and therefore doesn't handle many language features.
@rrawat-dev What version of babel-loader are you using? The error here seems to be that webpack 2 doesn't support arrow functions, at least not as class properties. (There are many arrow functions used in the SDK, but the first encountered is where the error message is.)
You will likely need a babel plugin which transforms arrow function class properties. Most of the babel packages that old are archived, which makes locating the correct one difficult.
Theoretically something like babel-plugin-transform-class-properties
.
Hi @kinyoklion, Upgraded to webpack 5. Working fine now.
@rrawat-dev Great, thank you for letting me know! I am going to close this issue.
I am getting following error while trying to load launchdarkly-js-client-sdk using webpack 2:
ERROR in ./~/launchdarkly-js-client-sdk/dist/ldclient.es.js Module parse failed: node_modules/launchdarkly-js-client-sdk/dist/ldclient.es.js Unexpected token (1:3500)
You may need an appropriate loader to handle this file type.
File content to load from node_module/launchdarkly-js-client-sdk/dist/ldclient.es.js https://unpkg.com/launchdarkly-js-client-sdk@3.4.0/dist/ldclient.min.js
webpack loader config:
{ test: /\.es\.js$/, use: [{ loader: 'babel-loader', options: [{ presets: [['babel-preset-env']] }] }] }
error after above config:ERROR in ./~/launchdarkly-js-client-sdk/dist/ldclient.es.js Module build failed: Syntax Error: node_modules/launchdarkly-js-client-sdk/dist/ldclient.es.js Unexpected token, expected ( (1:37325)