-
-
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
Change devDependency to dependency #1941
Comments
I guess this issue is related?
|
@lillijo Try to downgrade the major version of d3-scale, you're running into the same issue we hit. |
I added more details to #1951, but in short in 0.79 If using Yarn 2/3 berry you can add this temporary workaround to # .yarnrc.yml
...
packageExtensions:
'@nivo/legends@*':
dependencies:
'd3-scale': '*'
'@nivo/colors': '*'
...
Another successful workaround is to downgrade Nivo to 0.78 |
I think there's a slightly different issue mentioned by @joshribakoff-sm I'm seeing this issue with
EDIT: switching to Next.js loose mode as suggested by the link in the error seems to fix the issue! |
This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment! |
Bump |
This only worked for me if declared as
|
This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment! |
Not stale. |
finding nivo unusable with create-t3-app due to this issue, any suggestions? |
I'm trying to address this issue in #2313 |
Has this issue been fixed? I'm still getting this error while trying to use @nivo/funnel
It gets fixed if I change my next js config to
But this hardly seems like a solution, and I'm kind of stuck using nivo, as I found only nivo to provide really good React-friendly docs and good-looking default styling. I've used react-chart-js-2 and material UI, as well on the project could those be causing conflicts? |
@IshfaqAhmedProg why do you think it's not a solution? This is what next recommends in such case.
It seems like you're "stuck" for good reasons at least :) Also the issue you're reporting is different from this one, it's more about #2310. |
The issue has been solved in |
@plouc hello, so what do we have to do to correct the issue ? |
@julienmunar hello, to install the latest version, but please note that you might run into import issues depending on your setup due to esm only d3 packages (#2310). |
Hi @plouc - I am still experiencing this issue in 0.83.0, is this a common issue? |
Experiencing this issue in 0.83.0 aswell here, how can we prevent this from happening? |
Also bumped this issue in 0.83.0 |
@mt-hagen, @Joeghanoe, @KupriyanovNikita, could you please provide more details? I'm a bit confused that it still happens as there's no dev dependencies anymore: https://github.com/plouc/nivo/blob/v0.83.0/packages/legends/package.json. |
i got a similar error building my nextjs project. Heres the trace if it helps:
importing these as dependencies:
|
There are 2 different issues, which can be confusing I guess, dependencies weren't properly defined, it's especially an issue when using |
I still get the same error in 0.83 when I use @nivo/line |
same issue with @nivo/radial-bar |
this didn't work for me, getting error Instead change the require of index.js in /srv/v2/browser/node_modules/@nivo/colors/dist/nivo-colors.cjs.js to a dynamic import() which is available in all CommonJS modules. |
Try updating using |
I appreciate your reply! |
I forgot to say even i had it at 0.83.0 when i first installed the package, then after encountering the error i ran npm audit fix --force which downgraded the package version to, from what i remember, 0.81.0, then i manually updated it using the command stated above, that let me use it fine without any runtime error! Also if you're using next js in the #2310 issue, some people solved it using dynamic import although that didnt work for me as i needed it to be SSR! |
Still having this problem on 0.83.0. Any solution by now? |
same here |
1 similar comment
same here |
@plouc Could you implement this fix? Thanks! |
For an ugly workaround in Next.js you could add the following to your
|
So it's unusable in next.js? |
im having this issue with remix too any dieas? |
Same issue with @nivo/network - using the loose mode in next.config.js only seems to fix the issue every 2-3 reloads (this is using Next v12). Can confirm that rolling back to 0.79 fixes the issue @plouc - my instincts tell me this has something to do with server-side rendering maybe? edit: rolling back to 0.79 fixed Network but broke Bullet. See my workaround below. |
For what it's worth, a workaround is to wrap a container component around the offending Nivo chart (I have trouble with Network and Bullet at the moment, but I suspect it's all the charts), save it as it's own file so that's the file that imports directly from @nivo, and then use Next.js's dynamic import with
|
This fixed the issue for me thanks |
TL;DR: The error occurs on the server side; try client-side loading instead. I encountered the same issue when using the Nivo library with Astro and React: "require() of ES Module .../node_modules/d3-interpolate/src/index.js from .../node_modules/@nivo/core/dist/nivo-core.cjs.js not supported. Instead, change the require of index.js in .../node_modules/@nivo/core/dist/nivo-core.cjs.js to a dynamic import() which is available in all CommonJS modules." This issue arises when trying to use nivo components on the server side. I resolved it by configuring my component to load client-side only. In Astro, you can do this by setting client:only="react". After making this change, everything worked smoothly, and my chart rendered as expected. For reference, I'm using Nivo version 0.87.0. For developers facing similar issues with Next.js, you might need to set ssr: false to ensure the components load on the client side only. |
You have
d3-scale
as adevDependency
for nivo legends https://github.com/plouc/nivo/blob/master/packages/legends/package.json#L27When we try to run your basic "hello world" examples we got:
This should be moved to
dependency
or added as apeerDependency
(preferably the former), otherwise it requires the user of Nivo to debug this. Naively one may try to installd3-scale
in theirpackage.json
which will cause even more issues since the latest major version of said package is relying on experimental node features which will throw nonsensical errors taking the user further down the rabbit hole.I believe this one small fix will greatly improve the DX for this library.
The code you publish in your
dist
forlegends
does arequire("d3-scale")
so this is not adevDependency
.The text was updated successfully, but these errors were encountered: