Skip to content
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

Add exports field to packages #8054

Merged
merged 2 commits into from
Nov 3, 2022
Merged

Add exports field to packages #8054

merged 2 commits into from
Nov 3, 2022

Conversation

emmatown
Copy link
Member

This adds the exports fields to the packages using Preconstruct, the only ways this really affects consumers is that:

  • Entrypoints that are not at the root of a package can be imported from Node ESM (the root could be imported previously)
  • In Node, some bundlers and TypeScript's "moduleResolution": "nodenext", anything that isn't specified in the exports will not be allowed to be imported outside the package. For example, people won't be able to reach into the dist directory and import some random file. (Note this also applies in CommonJS, not only ESM)

For people who have seen the exports field before, you might be expecting to see the import condition used. We are intentionally not using it here as we don't ship ESM for Node. We do use the module condition though which is respected by some bundlers (but not Node).

@vercel
Copy link

vercel bot commented Oct 31, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
keystone-next-docs ✅ Ready (Inspect) Visit Preview Oct 31, 2022 at 2:18AM (UTC)

@changeset-bot

This comment was marked as resolved.

@codesandbox-ci
Copy link

codesandbox-ci bot commented Oct 31, 2022

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit c10e9c0:

Sandbox Source
@keystone-6/sandbox Configuration

@vercel vercel bot temporarily deployed to Preview October 31, 2022 02:18 Inactive
@emmatown emmatown marked this pull request as ready for review October 31, 2022 02:36
@emmatown emmatown requested a review from a team October 31, 2022 02:36
@dcousens dcousens merged commit f72a3d9 into main Nov 3, 2022
@dcousens dcousens deleted the exports-field branch November 3, 2022 04:08
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.

2 participants