Skip to content

Define "exports" in package.json #2080

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

Merged
merged 4 commits into from
Mar 29, 2025
Merged

Define "exports" in package.json #2080

merged 4 commits into from
Mar 29, 2025

Conversation

jdeniau
Copy link
Member

@jdeniau jdeniau commented Mar 25, 2025

Partially fixes #2064

@jdeniau jdeniau linked an issue Mar 25, 2025 that may be closed by this pull request
@jdeniau jdeniau force-pushed the package-json-exports branch 4 times, most recently from 9723c23 to 1711791 Compare March 26, 2025 19:01
@jdeniau jdeniau requested a review from Copilot March 29, 2025 00:15
Copy link

@Copilot Copilot AI left a 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 is focused on updating the build configuration to better align with the defined "exports" in package.json, partially addressing issue #2064.

  • Updated the output file extension in the Rollup configuration from .es.js to .mjs.
  • Modified the Jest resolver to reference pkg.main instead of pkg.module in the CI environment.
  • Adjusted the build output check to validate files based on the new exports fields in package.json.

Reviewed Changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated no comments.

File Description
resources/rollup-config.mjs Changed output file extension to better reflect ESM modules.
resources/jestResolver.js Updated the CI resolver to use pkg.main rather than pkg.module.
resources/check-build-output.mjs Revised expected file list to reference the exports objects.
Files not reviewed (1)
  • package.json: Language not supported
Comments suppressed due to low confidence (3)

resources/rollup-config.mjs:49

  • Ensure that renaming the output file to .mjs is consistent with all related configuration and references elsewhere in the project.
file: path.join(DIST_DIR, 'immutable.mjs'),

resources/jestResolver.js:8

  • Verify that using pkg.main in the CI environment correctly points to the intended build output, as changing from pkg.module may affect module resolution behavior.
return path.resolve(options.rootDir, pkg.main);

resources/check-build-output.mjs:11

  • Confirm that the package.json exports field is defined with the expected keys ('require', 'import', and 'types') so that the build output check accurately verifies the right files.
removeDistPrefix(packageJsonContent.exports['.'].require),

@jdeniau jdeniau force-pushed the package-json-exports branch from 1711791 to a1115ef Compare March 29, 2025 13:31
@jdeniau jdeniau merged commit 2467bd7 into 6.x Mar 29, 2025
5 checks passed
@jdeniau jdeniau deleted the package-json-exports branch March 29, 2025 13:33
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.

Fix package.json warning
1 participant