Skip to content

Commit

Permalink
fix(types): conflicts with peer types (#852)
Browse files Browse the repository at this point in the history
With our recent changes in bundling, there's a new problem with the
framework-specific SDKs (react + nestjs). These have peers, and the
external function was bundling those peers as well, which can cause tsc
errors due to conflicts. This change prevents us from bundling any peers
(which is what we want, so we avoid conflicts with the consumers
installed peers).

This has no runtime impact, and there was no changes to core, web, or
server SDK dists. See image below for the difference in the react SDK
(notice peers are now IMPORTED):


![image](https://github.com/open-feature/js-sdk/assets/25272906/0bdd16d6-d1c0-4118-9bf4-93659c164090)

---------

Signed-off-by: Todd Baert <[email protected]>
  • Loading branch information
toddbaert authored Mar 6, 2024
1 parent 0a12a5e commit fdc8576
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 7 deletions.
13 changes: 13 additions & 0 deletions packages/nest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,19 @@ Capabilities include:
npm install --save @openfeature/nestjs-sdk
```

#### npm

```sh
npm install --save @openfeature/nestjs-sdk
```

#### yarn

```sh
# yarn requires manual installation of the peer dependencies (see below)
yarn add @openfeature/nestjs-sdk @openfeature/server-sdk @openfeature/core
```

#### Required peer dependencies

The following list contains the peer dependencies of `@openfeature/nestjs-sdk` with its expected and compatible versions:
Expand Down
26 changes: 21 additions & 5 deletions packages/react/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,19 @@ The OpenFeature React SDK adds React-specific functionality to the [OpenFeature

In addition to the feature provided by the [web sdk](https://openfeature.dev/docs/reference/technologies/client/web), capabilities include:

- [Multiple Providers and domains](#multiple-providers-and-domains)
- [Re-rendering with Context Changes](#re-rendering-with-context-changes)
- [Re-rendering with Flag Configuration Changes](#re-rendering-with-flag-configuration-changes)
- [Suspense Support](#suspense-support)
- [Overview](#overview)
- [🚀 Quick start](#-quick-start)
- [Requirements](#requirements)
- [Install](#install)
- [npm](#npm)
- [yarn](#yarn)
- [Required peer dependencies](#required-peer-dependencies)
- [Usage](#usage)
- [Multiple Providers and Domains](#multiple-providers-and-domains)
- [Re-rendering with Context Changes](#re-rendering-with-context-changes)
- [Re-rendering with Flag Configuration Changes](#re-rendering-with-flag-configuration-changes)
- [Suspense Support](#suspense-support)
- [Resources](#resources)

## 🚀 Quick start

Expand All @@ -62,11 +71,18 @@ In addition to the feature provided by the [web sdk](https://openfeature.dev/doc
npm install --save @openfeature/react-sdk
```

#### yarn

```sh
# yarn requires manual installation of the peer dependencies (see below)
yarn add @openfeature/react-sdk @openfeature/web-sdk @openfeature/core
```

#### Required peer dependencies

The following list contains the peer dependencies of `@openfeature/react-sdk` with its expected and compatible versions:

* `@openfeature/web-sdk`: >=0.4.10
* `@openfeature/web-sdk`: >=0.4.14
* `react`: >=16.8.0

### Usage
Expand Down
7 changes: 5 additions & 2 deletions rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@ export default {
},
// function indicating which deps should be considered external: external deps will NOT have their types bundled
external: (id) => {
// bundle everything but '@openfeature/core', which is a peer
return id === '@openfeature/core';
// bundle everything except peer deps (@openfeature/*, @nest/*, react, rxjs)
return id.startsWith('@openfeature') ||
id.startsWith('@nest') ||
id === 'rxjs' ||
id === 'react';
},
plugins: [
// use the rollup override tsconfig (applies equivalent in each sub-packages as well)
Expand Down

0 comments on commit fdc8576

Please sign in to comment.