Skip to content

pdf-lib depends on a broken version of tslib #1752

@avalero

Description

@avalero

What were you trying to do?

Trying to use pdf-lib on Deno 2.4

How did you attempt to do it?

it produces this error

index.js:3 Uncaught TypeError: Cannot destructure property '__extends' of 'import_tslib.default' as it is undefined.
    at index.js:3:5
(anonymous)    @    index.js:3

This error throws just Just with const mergedPdf = await PDFDocument.create();

What actually happened?

pdf-lib depends on a broken version of tslib. The version it depends on is not valid ESM and a mix of CJS + UMD instead. This avoid using pdf-lib with Deno. Could you update tslib dependency

What did you expect to happen?

It should not throw any error :)

How can we reproduce the issue?

Try this on Deno 2.4

import {PDFDocument} from "npm:pdf-lib"
const mergedPdf = await PDFDocument.create();

Version

1.17.1

What environment are you running pdf-lib in?

Deno

Checklist

  • My report includes a Short, Self Contained, Correct (Compilable) Example.
  • I have attached all PDFs, images, and other files needed to run my SSCCE.

Additional Notes

pdf-lib depends on a broken version of tslib. The version it depends on is not valid ESM and a mix of CJS + UMD instead. This avoid using pdf-lib with Deno. Could you update tslib dependency

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions