fix(package): correct subpath export resolution for all module types#129
Merged
Conversation
damencho
approved these changes
May 11, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #129 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 7 7
Lines 1870 1870
Branches 47 47
=========================================
Hits 1870 1870 Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
The previous wildcard subpath export mapped `./*` to `./dist/*` without
extensions, so bundlers and Node's ESM resolver could not locate the
actual files for imports like `@jitsi/js-utils/random`.
The modules in this package use different layouts, so a single wildcard
cannot cover all of them:
- Directory modules (avatar, browser-detection, jitsi-local-storage,
random, transport) expose an `index` file, so map `./*` to
`./dist/*/index.{js,d.ts}`.
- `json` is a single file at the package root, so add an explicit
`./json` export pointing at `./dist/json.{js,d.ts}`.
- `polyfills/` exposes individual files rather than a barrel, so add a
dedicated `./polyfills/*` wildcard that maps each name to
`./dist/polyfills/*.{js,d.ts}`.
ed03114 to
77b80ce
Compare
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.
Summary
package.jsonso all documented import paths resolve correctly. The previous wildcard mapped./*to./dist/*without extensions, which prevented Node's ESM resolver and bundlers from locating the actual built files.avatar,browser-detection,jitsi-local-storage,random,transport) expose anindexfile. The wildcard./*now maps to./dist/*/index.jsand./dist/*/index.d.ts.jsonmodule lives at the package root, so add an explicit./jsonexport pointing at./dist/json.js/./dist/json.d.ts.polyfills/exposes individual files rather than a barrel, so add a dedicated./polyfills/*wildcard that maps each name to./dist/polyfills/*.js/./dist/polyfills/*.d.ts.Test plan
npm run buildsucceeds.import { randomHexString } from '@jitsi/js-utils/random') and verify it resolves todist/random/index.jswith matching.d.tstypes.import { safeJsonParse } from '@jitsi/js-utils/json'resolves todist/json.js.@jitsi/js-utils/polyfills/<name>) resolves to the matching file underdist/polyfills/.@jitsi/js-utils) still works unchanged.