Skip to content
This repository has been archived by the owner on Mar 8, 2023. It is now read-only.

Expose package subpaths with the "exports" field #443

Merged
merged 1 commit into from
Jul 16, 2020

Conversation

guybedford
Copy link
Contributor

This adds the "exports" field as defined in Node.js 12 and 14 to enable subpath imports.

The current form is backwards compatible because the base-level files have been explicitly listed.

Ideally with the exports field, exact entry points would be listed, but the list here would be well over 100 which could be some work, but would have some benefits in hiding internal non public modules.

For now though, this will provide support to CDNs such as jspm and Skypack which use the "exports" field to determine how to resolve package subpaths. Specifically for jspm.dev this would ensure all subpaths are iterated and served, since usually subpaths are ignored as they might be tests etc.

Happy to answer any further questions around this, and the full docs on the field are available here - https://nodejs.org/dist/latest-v14.x/docs/api/esm.html#esm_package_entry_points.

Copy link
Collaborator

@asudoh asudoh left a comment

Choose a reason for hiding this comment

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

LGTM 👍 - Thanks @guybedford for jumping in!

@asudoh asudoh merged commit ca4a04c into carbon-design-system:master Jul 16, 2020
@guybedford
Copy link
Contributor Author

Sure, thanks for the quick merge @asudoh!

kodiakhq bot pushed a commit to carbon-design-system/carbon-for-ibm-dotcom that referenced this pull request Jul 20, 2020
### Related Ticket(s)

Refs carbon-design-system/carbon-web-components#443.

### Description

This change adds [`exports` field](https://nodejs.org/dist/latest-v14.x/docs/api/esm.html#esm_package_entry_points) in `package.json`.
Doing so enables several CDNs that support module path mapping.

### Changelog

**New**

- `exports` field in `package.json`.
asudoh added a commit to asudoh/ibm-dotcom-library that referenced this pull request Sep 10, 2020
Adds `exports` fields to `services` and `utilities` packages as another
step to make Web Components work bettern in an environment without a
toolstack using CDN that supports ESM.

This is a similar change to:
carbon-design-system/carbon-web-components#443
kodiakhq bot pushed a commit to carbon-design-system/carbon-for-ibm-dotcom that referenced this pull request Sep 10, 2020
### Description

Adds `exports` fields to `services` and `utilities` packages as another step to make Web Components work bettern in an environment without a toolstack using CDN that supports ESM.

This is a similar change to:
carbon-design-system/carbon-web-components#443

### Changelog

**New**

- `exports` field to `services` and `utilities` packages.
ariellalgilmore pushed a commit to ariellalgilmore/carbon-for-ibm-dotcom that referenced this pull request Sep 14, 2020
### Description

Adds `exports` fields to `services` and `utilities` packages as another step to make Web Components work bettern in an environment without a toolstack using CDN that supports ESM.

This is a similar change to:
carbon-design-system/carbon-web-components#443

### Changelog

**New**

- `exports` field to `services` and `utilities` packages.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants