js-sdk-contrib icon indicating copy to clipboard operation
js-sdk-contrib copied to clipboard

feat(web-global-build): concept + impl?

Open zdunecki opened this issue 4 months ago • 4 comments

This PR

  • Adds a global (IIFE) build for the web for GrowthBook and LaunchDarkly

Notes

It's a concept only, I'm not quite sure if OpenFeature Community is likely to follow this idea. If so, I'll update this PR by improving a build process since this repository has a special build system.

How to test

  1. Run npm run build and ensure dist/global/index.js is generated for GrowthBook and LaunchDarkly web client

Motivation

Trying to load OpenFeature as a first dependency before browser will resolve any modules.

zdunecki avatar Aug 09 '25 14:08 zdunecki

Hey @zduneckim, I will have a look at this tomorrow :) Please also sign-off the commit for this, as with the other PR.

lukas-reining avatar Aug 10 '25 14:08 lukas-reining

@lukas-reining

What you think about this? As I said before, it's a concept only - let me know if idea is fine for you. If so, I'll try to fix test issues + find a better build solution and apply DRY.

Best,

zdunecki avatar Aug 29 '25 20:08 zdunecki

Hey @zdunecki sorry for the delay! I think this is a good addition! We should consider adding it to the generators if everyone is in favor: https://github.com/open-feature/js-sdk-contrib/blob/main/tools/workspace-plugin/src/generators/open-feature/index.ts#L166 It seems like it might be be enough to declare any vendor SDK as external and otherwise have a generic esbuild config?

lukas-reining avatar Sep 07 '25 19:09 lukas-reining

@lukas-reining No worries. Sounds cool, so if I'm back to contribution, I'll implement that.

Can't say when, but I'll try soon.

Best,

zdunecki avatar Sep 07 '25 19:09 zdunecki