-
Notifications
You must be signed in to change notification settings - Fork 48
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
Does this work in Next js? #51
Comments
I have the same issue in NestJs npm ERR! A complete log of this run can be found in: /Users/geust/.npm/_logs/2024-03-19T00_55_01_156Z-debug-0.log |
For the original question, I think you can make it work by adding the dependecy on next.config
|
Okay, seems like this does not work anymore |
Were you able to solve it? |
I got it working. This was the
And using node version 21 |
Thank you so much man! That worked for me :) |
This worked for me. By changing
|
Thanks @jakate , I spent a few hours on this!! |
This works in development but is failing for me in prod.
Would the file path be different after building? |
I'm running my app on Vercel and it seems to work with that config just fine. |
@jakate Is your repo public? I'd love to take a look |
I'm sorry, it's not public, so I can't really share that 😕 |
I also encountered some issues with this, but since I was using pnpm in my setup, I had to make a few changes to get it working on Vercel. Here's my configuration: experimental: {
serverComponentsExternalPackages: ['pdf-img-convert'],
outputFileTracingIncludes: {
'/api/convert-to-img': [
'./node_modules/.pnpm/pdfjs-dist*/node_modules/pdfjs-dist/legacy/build/pdf.worker.js',
'./node_modules/.pnpm/pdfjs-dist*/node_modules/pdfjs-dist/legacy/build/pdf.js',
],
},
}, Note the |
@jakate @alexbacanu you saved me there, thanks |
Wasn't able to get this working, error was import fetch from 'node-fetch';
^^^^^^
SyntaxError: Cannot use import statement outside a module |
To solve that, I added e.g. // next.config.ts
const nextConfig: NextConfig = {
transpilePackages: ["pdf-img-convert"],
}; |
I can get this working in node, but when I try to convert it to a Next js 14 server action, I get this error:
⨯ node_modules\pdf-img-convert\node_modules\pdfjs-dist\legacy\build\pdf.js (5903:35) @ eval
⨯ Error: Setting up fake worker failed: "Cannot find module './pdf.worker.js'
The text was updated successfully, but these errors were encountered: