Skip to content

fix(openfeature-node-provider): allow ESM imports - #820

Merged
roncohen merged 2 commits into
mainfrom
fix/openfeature-node-esm
Nov 27, 2026
Merged

roncohen merged 2 commits into
mainfrom
fix/openfeature-node-esm

Conversation

@roncohen

Copy link
Copy Markdown
Contributor

Fixes #819.

Summary

  • Add a default export condition so ES modules can load the provider's existing CommonJS build instead of failing with ERR_PACKAGE_PATH_NOT_EXPORTED.
  • Keep the CommonJS entry point, TypeScript declarations, dependencies, and provider API unchanged.
  • Add native Node.js smoke tests to CI for CommonJS, static and dynamic ESM imports, named/default interop, and shared export identity.
  • Include a patch changeset.

Validation

  • 32 existing provider/example tests and 2 new native Node.js smoke tests passed. The ESM regression failed before the fix.
  • CommonJS and ESM imports also passed against a packed tarball.
  • Provider build, type-check, scoped lint, formatting, and 17 release safeguards passed.
  • Audited packed artifacts for all 11 publishable packages: no missing declared entry points or additional ESM export failures found. Checked nine libraries with both CommonJS and ESM, the CLI with --help, and TypeScript NodeNext consumers in both module modes.

The broader audit compiled the Management SDK from checked-in generated sources; it did not regenerate them. React Native's entry points and types were checked, but its runtime was not exercised. The full monorepo test suite was not run.

@reflag-review reflag-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Risk: medium

no actionable findings

@reflag-review reflag-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Risk: low

no actionable findings

@roncohen
roncohen enabled auto-merge November 27, 2026 11:57
roncohen added a commit that referenced this pull request Nov 27, 2026
## Summary

- Backport #820 to `maintenance/v1`. The Node.js OpenFeature provider
currently exports its package entry point only to CommonJS, so native
ESM imports fail with `ERR_PACKAGE_PATH_NOT_EXPORTED` (#819).
- Add a `default` export condition that points to the existing CommonJS
build. The CommonJS entry point, TypeScript declarations, dependencies,
and public API are unchanged.
- Add a patch changeset. This PR does not change publishing; the
maintenance branch's existing publish workflow only releases the CLI.

## Validation

- Built the v1 Node SDK and OpenFeature provider. All 28 existing
provider tests passed.
- Installed the provider tarball in a clean temporary directory. On
Node.js 24.22.0, the named ESM import and CommonJS `require()` both
loaded the same `ReflagNodeProvider` export.
- Formatting and `git diff --check` passed. No new CI tests were added.
@roncohen
roncohen added this pull request to the merge queue Nov 27, 2026
Merged via the queue into main with commit c0dd5ec Nov 27, 2026
9 checks passed
@roncohen
roncohen deleted the fix/openfeature-node-esm branch November 27, 2026 12:09
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.

@reflag/openfeature-node-provider cannot be imported from ESM

1 participant