Export all library subpaths with dual ESM/CJS support#924
Merged
Conversation
Compile the full lib tree to dist/esm, generate package.json exports for every module (canonical and dist-prefixed paths), and export utils from the barrel so consumers can import subpaths without bundler aliases. Co-authored-by: Cursor <cursoragent@cursor.com>
Only expose canonical subpaths like expensify-common/API; consumers should not rely on expensify-common/dist/API. Co-authored-by: Cursor <cursoragent@cursor.com>
No current consumer loads dist/esm via native Node resolution in a way that needs extension patching; bundlers and CJS paths cover App and GitHub-Actions usage. Co-authored-by: Cursor <cursoragent@cursor.com>
Add required JSDoc @param tags and include scripts/ in npm run lint. Co-authored-by: Cursor <cursoragent@cursor.com>
chuckdries
approved these changes
Jun 26, 2026
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Export every compiled module through
package.jsonexportswith dual ESM/CJS support. Consumers can importexpensify-common/Device,expensify-common/utils, etc. without thedist/prefix, while existingexpensify-common/dist/*paths keep working. The barrel also re-exportsutilshelpers for top-level imports.Fixed Issues
For Expensify/App#93222
Tests
__tests__/package-exports-test.jscovers barrel, CLI, Device, utils, nested components, and verifies every compiled entry has canonical +dist/-prefixed exports.npm run buildand confirm it generatesdist/esm/*plus the updatedpackage.jsonexports map.npm test -- __tests__/package-exports-test.jsand confirm all export-resolution tests pass.npm testand confirm the full suite passes.require('expensify-common/Device'),require('expensify-common/dist/Device'),import('expensify-common/utils'), andimport('expensify-common')all resolve in Node.QA