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

Error [ERR_REQUIRE_ESM] in @react-pdf/renderer with Next.js Despite Using ES Module Import #3017

Open
faezegholami opened this issue Dec 30, 2024 · 0 comments

Comments

@faezegholami
Copy link

Describe the bug
I'm encountering an error while using @react-pdf/renderer in my Next.js project. The error occurs during the build process and indicates that I should use import() instead of require(). However, I am already importing the module using import, not require().

Instead change the require of react-pdf.js in D:\....\.next\server\app\(routes)\(main)\landing\mvm\register\page.js to a dynamic import() which is available in all CommonJS modules.
    at mod.require (D:\...\node_modules\next\dist\server\require-hook.js:65:28)
    at 29376 (D:\...\.next\server\app\(routes)\(main)\landing\mvm\register\page.js:1:314595)
    at Object.t [as require] (D:\....\.next\server\webpack-runtime.js:1:143)
    at require (D:\....\next\dist\compiled\next-server\app-page.runtime.prod.js:16:18365)
    at I (D:\.....\node_modules\next\dist\compiled\next-server\app-page.runtime.prod.js:12:94362)
  • OS: [e.g. MacOS, Windows]
  • Browser [chrome]
  • React-pdf version [^4.1.5]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant