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

fix: Change package type back to default of "commonjs" #331

Merged
merged 2 commits into from
Sep 5, 2024

Conversation

csandman
Copy link
Owner

@csandman csandman commented Sep 5, 2024

Closes #329

This PR removes the "type": "module" config from the package.json, in order to fix the path that Jest is pulling the package from. I'm not really an expert on Jest and where it pulls it's imports from, but the issue #329 appears to be caused by a mismatch of ESM and CJS imports. The goal of v4.9 was really to enable ESM imports in general, and this still works without using the module type, because the ESM version is pulled using the exports field (if the environment is setup correctly).

So, after changing the type back to commonjs (by just removing it, commonjs is the default), the fix with the consistent IDs (#298) still appears to work fine for me in my test environment, so I'm fine with this approach. Plus, this actually better matches the package exports for both react-select and @chakra-ui/react, which I generally try and align with as much as possible, so that's a plus.


I tested this against the test file provided by @hatajoe and have verified that the test runs fine after this change.

Copy link

codesandbox-ci bot commented Sep 5, 2024

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.

Copy link

github-actions bot commented Sep 5, 2024

📊 Package size report   -1.73%↓

File Before After
dist/index.cjs 17.2 kB
dist/index.cjs.map 81.3 kB
dist/index.d.cts 21.1 kB
dist/index.d.mts 21.1 kB
dist/index.js 16.0 kB 5%↑16.7 kB
dist/index.js.map 81.7 kB -2.68%↓79.5 kB
dist/index.mjs 15.3 kB
dist/index.mjs.map 79.5 kB
package.json 3.3 kB 5%↑3.4 kB
Total (Includes all files) 289.2 kB -1.73%↓284.2 kB
Tarball size 67.0 kB -5.01%↓63.7 kB
Unchanged files
File Size
dist/index.d.ts 21.1 kB
LICENSE.md 1.1 kB
README.md 46.3 kB

🤖 This report was automatically generated by pkg-size-action

"files": [
"dist"
],
"scripts": {
"build": "tsup",
"check-exports": "attw --pack .",
Copy link
Owner Author

Choose a reason for hiding this comment

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

I also added the package @arethetypeswrong/cli in order to more easily ensure that the exports are set up correctly after every change, as this is the real thing I've been trying to make sure of.

@csandman csandman merged commit 3634f8f into main Sep 5, 2024
5 checks passed
@csandman csandman deleted the fix/default-package-type branch September 5, 2024 01:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants