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

fix: remove events.js from core module #650

Merged
merged 1 commit into from
Nov 3, 2023

Conversation

toddbaert
Copy link
Member

@toddbaert toddbaert commented Nov 2, 2023

Optimization to @openfeature/core package. Both server and web need the node-js Events interfaces, but obviously only the web needs them poly-filled (they come with node).

This PR:

  • marks events.js as an external dep in @openfeature/core meaning it won't be bundled there (see esbuild doc)

This means that now @openfeature/core no longer includes events.js (an un-needed polyfill for the server). The bundling pictured below only happens in the dist/ of @openfeature/web-sdk, and no longer in @openfeature/core :

image

I've tested both the server and web SDKs based on this change locally in the js-contribs by running the e2e test suite.

Relates to: #616

@toddbaert toddbaert requested a review from a team as a code owner November 2, 2023 20:47
@toddbaert toddbaert changed the title fix: remove events.js from core fix: remove events.js from core module Nov 2, 2023
Copy link
Member

@lukas-reining lukas-reining left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

Copy link
Member

@beeme1mr beeme1mr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, nice find.

@toddbaert toddbaert added this pull request to the merge queue Nov 3, 2023
Merged via the queue into main with commit 14441b1 Nov 3, 2023
18 checks passed
@toddbaert toddbaert deleted the fix/remove-duped-events-bundling branch November 3, 2023 16:59
toddbaert pushed a commit that referenced this pull request Nov 3, 2023
🤖 I have created a release *beep* *boop*
---


##
[0.0.17](core-v0.0.16...core-v0.0.17)
(2023-11-03)


### Bug Fixes

* remove events.js from core module
([#650](#650))
([14441b1](14441b1))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

---------

Signed-off-by: OpenFeature Bot <[email protected]>
Signed-off-by: openfeature-peer-update-bot <[email protected]>
Co-authored-by: openfeature-peer-update-bot <[email protected]>
github-merge-queue bot pushed a commit that referenced this pull request Nov 9, 2023
Fixes: #659

This PR fixes an issue created with [this
change](#650), which removed
the `events` polyfill package from `@openfeature/core` where is wasn't
always needed (see that issue for details). The problem was that we
still imported `events` in the `@openfeature/core` module, but can't use
the `events` bundled in the `@openfeature/web-sdk` since the bundled
package there isn't accessible from imports in `@openfeature/core`.

This PR _**removes all imports of `events`**_ from `@openfeature/core`,
and instead only imports types. Imports of `events` only now occur in
the web-sdk (where it's bundled) and server-sdk (where it's made
available by the node runtime), not in the common module.

Unfortunately this issue was a bit tough to track down, because `events`
is VERY common, and lots of bundlers, etc will add it, so it's
frequently available "accidentally".

Thanks to @juanparadox for the report.

---------

Signed-off-by: Todd Baert <[email protected]>
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

Successfully merging this pull request may close these issues.

4 participants