-
-
Notifications
You must be signed in to change notification settings - Fork 343
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
refresh - SyntaxError: Cannot use import statement outside a module #83
Comments
@airxiaotian require won't work, the import will Can you provide more information about the environment where you plan to use this org chart? Is it node.js? |
React, next.js, refreshing the page, it occurred. but if entering the page from another page, it doesn't occur |
yes, node js , by using |
This is react.js integration sample - https://stackblitz.com/edit/d3-org-chart-react-integration-hooks I can't reproduce it, can you fork and link the reproduced example? |
https://github.com/airxiaotian/d3-org-bug-reproduce everything working right if entering |
hi, i reproduced this problem. environment:
create a next-app
add d3-org-chart
add only one line of code into ./pages/index.js
start up server, then access http://localhost:3000, the problem reproduced.
|
@bumbeishvili |
Are you sure? Because nothing changed between |
sorry, i confirmed again. |
can I know your node version? |
This directly relates to this issue: Seems to be an issue with server side rendering with NextJS. I was able to solve the issue by importing the OrgChart class like so:
Opposed to the suggested react implementation:
|
I also switched useLayoutEffect for juts useEffect (since SSR won't be able to use the useLayoutEffect hook effectively) |
Good to know, thanks |
This issue should be fixed now since #77 is fixed, closing for now. Let me know if issue reappears |
I'm facing the same issue on NextJs. However the error stack is as fallows:
|
Manually setting |
Oddly, to me at least, this works. How do the upvoters implement this for deployment. Surely you don't run a script to add @bumbeishvili can this not be added in general to the package.json as a PR?
|
any updates? |
Describe the bug
React, next.js, refreshing the page, it occurred. but if entering the page from another page, it doesn't occur
To Reproduce
Steps to reproduce the behavior:
Screenshots

Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: