Skip to content
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

Nextjs transpilation error. #1770

Open
chiddekel opened this issue Nov 15, 2022 · 4 comments
Open

Nextjs transpilation error. #1770

chiddekel opened this issue Nov 15, 2022 · 4 comments
Labels
Milestone

Comments

@chiddekel
Copy link

How to avoid build error on nextjs?
Error [ERR_REQUIRE_ESM]: require() of ES Module
(...) node_modules/d3-array/src/index.js from
(...) node_modules/d3fc/build/d3fc.js not supported. Instead change the require of index.js in
(...) node_modules/d3fc/build/d3fc.js to a dynamic import() which is available in all CommonJS modules.

@ColinEberhardt
Copy link
Member

Hi @chiddekel you're going to have to add a bit more detail here, can you outline the steps to reproduce?

@chiddekel
Copy link
Author

This error message is when start build nextjs app with d3fc.
To reproduce this error in nextjs Import d3fc and start build with nextjs app - npm run build.

@izorg
Copy link

izorg commented Jan 13, 2023

@chiddekel use Module Transpilation functionality of Next.js 13 https://nextjs.org/docs/advanced-features/compiler#module-transpilation. In next.config.js for example add

{
  ...
  transpilePackages: ["@d3fc/d3fc-label-layout"],
  ...
}

@FourLeafTec
Copy link

Same problem for me.

Error Example

And I have try add type: "module" in package.json, transpilePackages in next.config.js, module:'esnext' in tsconfig.json. All of them not work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants