Skip to content

Reduce bundle size / tree shaking #1570

Open

Description

@MickL

Bundle size is critical for both web browsers as well as serverless functions. Unfortunately using just a few basic functions already adds 1,18 mb (299 kb gzipped).

It would be great if bundle size would be reduced. One way to do so would be to allow tree shaking instead of importing everthing, e.g.:

import { PDFDocument, registerFont, image, fontSize } from 'pdfkit';

const doc = new PDFDocument(options);
doc.pipe(registerFont('...'), image('...'), fontSize(9))

Possibly related: #1367

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions