-
-
Notifications
You must be signed in to change notification settings - Fork 247
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
TypeError: import_upng.default.decode is not a function #586
Comments
What build tool are you using? I've had this problem using esbuild. The problem appears to be that I worked around this issue by adding a function to force the use of the commonJS module:
However, you are the third person to encounter this now so we should think of a proper solution. Either there's something in the build config for I will try to look at this soon, but for now does the above help you as a workaround? |
We are using the serverless framework to deploy our functions to AWS Lambda and with version 4 it has built in support for esbuild. I switched it off by adding the following to my serverless.yml file which then allows us to build with commonjs:
This seems to have fixed the issue, but your comment helped us to get to this solution. |
OK, I'm glad you sorted it. Let's keep this issue open because it needs fixing. |
Describe the bug
We are encountering the following issue when using the generate function.
TypeError: import_upng.default.decode is not a function at PNG (/node_modules/@pdfme/pdf-lib/src/utils/png.ts:51:23) at Function.PNG.load (/node_modules/@pdfme/pdf-lib/src/utils/png.ts:41:42) at Function.for (/node_modules/@pdfme/pdf-lib/src/core/embedders/PngEmbedder.ts:12:21) at _PDFDocument.embedPng (/node_modules/@pdfme/pdf-lib/src/api/PDFDocument.ts:1100:40) at pdfRender2 (/node_modules/@pdfme/schemas/src/barcodes/pdfRender.ts:20:26) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at generate (/node_modules/@pdfme/generator/src/generate.ts:61:9) at generateLabelHandler (/src/handlers/generateLabelHandler.ts:208:29)
To Reproduce
Here is an example of how we are calling the function.
Expected behavior
Generate the pdf.
Your Environment
Your Error Log
Additional context
No response
The text was updated successfully, but these errors were encountered: