-
Notifications
You must be signed in to change notification settings - Fork 75
LG-5764 add default export for new package format #3487
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
base: main
Are you sure you want to change the base?
LG-5764 add default export for new package format #3487
Conversation
🦋 Changeset detectedLatest commit: 72eb163 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds a top-level "default" export to the @lg-charts/legend package to resolve Jest module resolution issues in downstream projects (specifically MMS unit tests) that occurred after publishing non-minified bundles.
Changes:
- Added a fallback
"default"export pointing to the UMD bundle - Documented the change with a patch-level changeset
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| charts/legend/package.json | Added top-level "default" export mapping to UMD bundle for Jest compatibility |
| .changeset/shaky-regions-vanish.md | Added changeset documenting the patch fix |
charts/legend/package.json
Outdated
| ".": { | ||
| "types": "./dist/types/index.d.ts", | ||
| "types@<=5.0": "./dist/types/ts4.9/index.d.ts", | ||
| "default": "./dist/umd/index.js", |
Copilot
AI
Jan 27, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default export is positioned before the 'import' and 'require' conditions in the exports map. According to Node.js module resolution rules, conditions are evaluated in order, and 'default' should be placed last as a fallback. Moving it after all other conditions ensures proper resolution across different environments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it that bad? fields in a json object are supposed to be unordered.
it wouldn't hurt to move it to last however, done ✅
|
Size Change: 0 B Total Size: 1.83 MB ℹ️ View Unchanged
|
|
Coverage after merging LG-5764_improve_non_minified_package_description into main will be
Coverage Report for Changed Files
|
🎫 Ticket
LG-5764
📝 Description
Context: After publishing the non-minified bundle (see #3325), I found that MMS unit tests began failing.
Problem: Jest does not properly resolve modules when "exports" uses nested mappings, leading to issues in downstream projects.
Solution: Introducing a top-level
"default": "./dist/umd/index.js"export supplies a fallback path that Jest can consistently resolve.🧪 Documentation and Testing