-
Notifications
You must be signed in to change notification settings - Fork 189
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
Importing Issues - Error [ERR_REQUIRE_ESM]: Must use import to load ES Module #218
Comments
Sorry, but I can’t help with this. Good luck. |
@Infinitay This is an issue in Node when you try to use |
Relevant issue here #221 |
will This be solved? |
@wemod123 This is working as intended. Please read the release notes and comments above. |
I had this problem importing a chart that uses D3 in a Next JS project. I solved it by importing on the client-side with the import dynamic from 'next/dynamic';
const Lines = dynamic(() => import('components/charts/Lines'), { ssr: false }); |
not working here, ts-node's issue maybe? import { max, min } from 'd3-array';
export default function() {
// my code
}
|
Maybe try the suggestion in the error and see if it works?
|
node:
v16.1.0
TypeScript:
v4.3.4
d3-array:
v3.0.1
I managed to get d3-array working properly without using TypeScript in project I'm testing; however, I'm having issues refactoring the same project using TypeScript because of an import issue I'm having with d3-array.
--
I've been following the closed issues in this repo and other issues on the same subject and was led to two pages with possible solutions:
- This didn't help me much and I was still faced with other issues
- After following this solution, I stopped getting that error or any other from the first solution page.
- However, now I was met with another issue in which Node wasn't happy with my CommonJS packages such as node-postgres and asking me to import it a different way.
--
I've went ahead implemented the second solution so the problem isn't an issue anymore. Nonetheless, I was wondering if this issue is with Node itself, or if there is a way to mitigate it within d3-array to resolve the ESM issue?
The text was updated successfully, but these errors were encountered: