-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Specify CJS vs ESM exports for @nivo/colors package #2246
base: master
Are you sure you want to change the base?
Conversation
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 b0a29a2:
|
Thanks for the PR @D-Maher . Do you reckon this would resolve the issue we're having when running our application in
|
@GeospatialMax That is my hope. In fact, I submitted this PR to address that very same issue when running my app in Vitest. When I run my tests, I am seeing a similar error related to
Looks like a variety of Nivo packages result in errors like this, not just |
FYI @D-Maher : I managed to resolve this by adding this to my test configuration (in my case in vite.config.ts - based on this comment)
This ensures that the es modules are used instead of the cjs modules and prevents errors with further dependencies downstream. |
@GeospatialMax Curious, I like this approach you've got here, but it doesn't seem to work for me (whereas the PR variant does work). Thinking maybe the difference is how projects are set up--do you have a standard @plouc no rush, just wondering if you maybe have some thoughts. |
@arnamak Interesting, currently still using standard |
facing same issue with PnP |
@GeospatialMax I just fixed the issue for PnP with below code
|
finding nivo unusable with create-t3-app due to this issue, any suggestions? |
@plouc this would be a welcome change |
@plouc Can we get this merged please 🙏 |
This pull request has been automatically marked as stale. If this pull request is still relevant, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize reviewing it yet. Your contribution is very much appreciated. |
bump |
TypeScript has difficulty in trying to import @nivo/colors as an ESM module. This is because
"main"
in @nivo/colorspackage.json
is specified as"./dist/nivo-colors.cjs.js"
.This PR adds an
exports
field to the @nivo/colorspackage.json
in order for TypeScript to be able to resolve the ESM module when declaring:If this is a welcome change, I am happy to update other Nivo packages accordingly.