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
Is this an ESM-first module now? #48
Comments
@botre - sorry to hear about the issue. let me provide some feedback below.
It shouldn't be. In the latest release, I upgraded the
100% - I did not realize this was happening. If it was I would have documented and bumped major version. I'm running the project in 2 different CRA applications and not seeing this error. Did you manually include those deps? Can you try deleteing your yarn/npm lock and reinstalling? |
I think CRA supports ESM and transpilation out of the box (unlike Next.js and other tools). |
I have created a minimal reproduction for this issue, see this repo: https://github.com/botre/reaviz-next-repro |
Thank you - Im digging into this - will let you know tomorrow how we can proceed |
Let me know if there is anything I can help with. |
OK - I bumped the version to a major so others are aware. I don't know the fix yet though. REAVIZ does have a CJS version but I don't know why the d3-* packages are being difficult. I will keep digging in and let me know if you find anything. |
@jazznerd206 No resolution yet - any help would be greatly appreciated! |
yeah buddy. i'll give it a shot. |
I don't wanna get too far ahead of myself, but d3 might have solved the problem for us. The specific dep that's throwing the error for me is d3-array, and according to your package.json, you have v3.0.4, and there is a new version, 3.1.1 available as of 1 month ago. According to the changelog, they have updated it to es6, so import should actually work now. I'll report back after some testing. |
Ya - This started when d3-* made their packages ESM and since its a dep of reaviz if your app isn't setup to handle esm then the error happens. |
@amcdnl Hey, so it turns out that was exactly my problem, not a problem with reaviz!! my fix was as follows: webpack.config.js sorry for conflating my mistake with your package!! |
Great news - glad you were able to resolve it. Let the group know if you find any of suggestions for this! |
In the end managed to get it working with dynamic imports, probably not ideal but at least it's a workaround 🤷🏼 import dynamic from "next/dynamic";
const Component = () => {
const [CalendarHeatmap, setCalendarHeatmap] = useState<any>(null);
useEffect(() => {
// mod.* can be anything you would normally import like BarChart, LineChart etc
const DynamicCalendarHeatmap = dynamic(() => import('reaviz' as any).then(mod => mod.CalendarHeatmap))
if(DynamicCalendarHeatmap) {
setCalendarHeatmap(DynamicCalendarHeatmap)
}
}, [])
return (
<div>
{CalendarHeatmap && <CalendarHeatmap data={calendarData} height={300} width="auto"/>}
</div>
);
}
Tried to debug the issue but no success on my end either. Here is what I tried:
At that point the only thing that left besides |
@sbsrnt - Thanks for the detailed report. I'm open to suggestions on ways to address this - I'm not sure what the best path is though. |
@amcdnl Could you please check this for the issue. Thanks |
@dpranav007 - Thanks for the ping. The comment in that ticket is very helpful. I need to research an alternative build configurations and in the meantime if u find anything relevant post in this thread. |
This is still an issue for with import dynamic from "next/dynamic";
const BarChart = dynamic(() => import("reaviz").then((mod) => mod.BarChart), {
ssr: false,
}); Next docs. The |
Hi I've tried using @zischwartz solution but it's not working when I try to import LinearXAxis and LinearYAxis. Below is my code.
This is the error: As we can see from the call stack, the error is coming from the isAxisVisible function, which is trying to read the props from LinearXAxis or LinearYAxis. I can't figure out why they are undefined. Can anyone advise on how to fix this? |
I'm happy to implement any suggestion someone might have, I just don't know the best way to fix this. I've also not hit it but I'm not doing NEXT/etc. |
same issue, not work in cra with ssr:
|
Please give this a try again! |
When bumping from 10.3.0 to 10.4.4 I encountered the following issue when building my project:
Is this an ESM-first module now?
In my opinion, this should be clearly stated in the documentation.
Also, since this breaks backward compatibility (given the current JS ecosystem), I think this should warrant a major version change; not a minor one.
The text was updated successfully, but these errors were encountered: