Skip to content

danielbucher/react-pdf-build-error-nextjs

Repository files navigation

This is a Next.js project bootstrapped with create-next-app.

I've sed node 20 for this. Suggested polyfills are imported in app/layout.tsx.

To setup the project:

npm install
npm run dev

Go to http://localhost:3000/, you should see the PDF render without issues. Issue happens when you try to have a prod build with npm run build.

I get a very long error but I managed to find the following message:

static/media/pdf.worker.min.9b170941.mjs from Terser
x 'import', and 'export' cannot be used outside of module code

About

Reproducing error using react-pdf with Next.js and app router

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published