launchdarkly / react-client-sdk

LaunchDarkly Client-side SDK for React.js
Other
79 stars 67 forks source link

Regression in 3.0.7: Attempted import error: 'useFlags' is not exported from 'launchdarkly-react-client-sdk'. #212

Closed danwdart closed 10 months ago

danwdart commented 11 months ago

Is this a support request? This issue tracker is maintained by LaunchDarkly SDK developers and is intended for feedback on the SDK code. If you're not sure whether the problem you are having is specifically related to the SDK, or to the LaunchDarkly service overall, it may be more appropriate to contact the LaunchDarkly support team; they can help to investigate the problem and will consult the SDK team if necessary. You can submit a support request by going here or by emailing support@launchdarkly.com.

Note that issues filed on this issue tracker are publicly accessible. Do not provide any private account information on your issues. If your problem is specific to your account, you should submit a support request as described above.

Describe the bug With a React app, I can't run yarn build with import { withFlags, withLDProvider } from "launchdarkly-react-client-sdk";, can only run yarn dev.

To reproduce With the preceding line in the build, yarn build fails with Attempted import error: 'useFlags' is not exported from 'launchdarkly-react-client-sdk'. however yarn dev works.

Expected behavior The particular functions should be available as soon as they are imported.

Logs Attempted import error: 'useFlags' is not exported from 'launchdarkly-react-client-sdk'.

SDK version

= 3.0.7

Language version, developer tools Node 18, yarn

OS/platform Alpine container

Additional context Odd that this seems okay in yarn dev but not when optimising code.

yusinto commented 11 months ago

Thank you for reporting this. We will investigate. Internally logged as 211138.

yusinto commented 11 months ago

@danwdart I am unable to reproduce this issue. The export looks correct in the npm lib if you see the last line you'll see useFlags. Also, we don't have an export called withFlags so I believe this maybe your own application's code.

What kind of optimization are you doing to reproduce the issue? Can you please share some more details of the problem: build tools, sample code, and steps to reproduce so we can try and help with this?

github-actions[bot] commented 10 months ago

This issue is marked as stale because it has been open for 30 days without activity. Remove the stale label or comment, or this will be closed in 7 days.