Question
PdfKit works fine on localhost but when I bundle it with webpack, the error PDFDocument is not a constructor is thrown on line "new PDFDocument()".
Description
It works if I bundle with NCC.
I guess it is related to webpack.
Code sample
const PDFDocument = require('pdfkit');
const pdf = new PDFDocument(); // <-- error
Your environment
- pdfkit version: 0.17 (latest version)
- Node version: 22
- Browser version (if applicable): Serverless App
- Operating System: AWS