@react-pdf/renderer doesn't work with swcMinify
set to true.
#40803
Labels
bug
Issue was opened via the bug report template.
swcMinify
set to true.
#40803
Verify canary release
Provide environment information
next info
What browser are you using? (if relevant)
Tested on Chrome, Firefox, and Brave
How are you deploying your application? (if relevant)
vercel
Describe the Bug
I'm using
@react-pdf/renderer
to create pdfs fromreact app
.It's all working fine as expected in the development environment, but when I build the app
and visit the page with pdf created by
@react-pdf/renderer
I got this errorI thought this was because I'm using react 18 and there's an issue in
@react-pdf/renderer
that says to add support with react 18 diegomura/react-pdf#2020.I try downgrading with this step https://stackoverflow.com/a/71972096/12720875. and it did work when I built the app with no error. But It is still at the latest using next12.1.2, and when upgrading to the latest nextjs the error appears again, and I need the feature of the latest nextjs.
and then i noticed that the error message says it's related to minification issue.
then I'm headed to next.config.js and remove
swcMinify: true
. and when I build the app and visit the pdf page. The error disappears.I mean the error was already resolved by doing so. But I will not get the advantage of minification of swc. Also, I am still confused about what happened. And since the
swcMinify
is already stable as per next 12.3.0 i think this shouldn't happen.Expected Behavior
There's no error with the production build result
Link to reproduction
https://github.com/bryantobing12/next-pdf-repro
To Reproduce
Steps to reproduce
yarn
to install depsyarn build
yarn start
localhost:3000/test
I was able to resolve that by removing
swcMinify: true
in next.config.jssteps
swcMinify: true
in next.config.jsconst nextConfig = { reactStrictMode: true, - swcMinify: true, };
yarn build
yarn start
localhost:3000/test
I'm hoping that this could be resolved without turning off
swc
minification :)The text was updated successfully, but these errors were encountered: