-
Notifications
You must be signed in to change notification settings - Fork 707
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
ReferenceError: window is not defined on next.js #149
Comments
I get this on my console
|
I have faced the same issue recently, and I was able to resolve by importing echarts-wordcloud on the client side: import {useEffect, useState} from "react";
import * as echarts from 'echarts/core';
import {CanvasRenderer} from "echarts/renderers";
import {
TitleComponent,
} from 'echarts/components';
echarts.use([
TitleComponent,
CanvasRenderer
]);
export default function WordCloudChartClientComponent(props) {
const [WordCloudInitialized, setWordCloudInitialized] = useState(false);
useEffect(() => {
// Initialize ECharts Word Cloud.
const initWordCloud = async() => {
await import('echarts-wordcloud');
setWordCloudInitialized(true)
}
initWordCloud();
}, []);
return (
<>
WordCloudInitialized ?
<SomeComponentDependentOnWordCloud echarts={echarts} />
: <p>Loading...</p>
</>
);
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, I'm trying to use this chart on next.js but I'm getting the ReferenceError: window is not defined on next.js.
I don't know what it can be since I'm already using other echarts charts on my project, I only get this erro, when I import echarts wordcloud.
If anyone here know what can be causing the error I really would appreciate the help.
Thanks guys for your awesome project.
The text was updated successfully, but these errors were encountered: