Skip to content

ES6/Webpack/etc Import issue #6

Open

Description

@brianmhunt

I am getting undefined from import PDFAssembler from 'pdfassembler' using Webpack (with a config that works with most libraries e.g. moment, pdfjs, jss, knockout/tko, file-saver, lodash).

I'm happy to put together a MWE to demonstrate, though I suspect the problem may be fairly apparent or trivial to solve.

An alternative would be to copy the pdfassembler.ts to dist/ since some folks (like myself) might be just as happy to use that directly.

Cheers.

Activity

  1. brianmhunt commented on Nov 2, 2018

    @brianmhunt
    Author

    Just for ease of reference, here are some CLI options for tsc:

    https://gist.github.com/jayphelps/51bafb4505558736fdba0aaf8bfe69d3

  2. brianmhunt commented on Nov 2, 2018

    @brianmhunt
    Author

    ...owing to the hefty size of the libraries (pdf.js notably) included, it might be worthwhile to distribute a version that links to global or provided options for these e.g. pdfAssembler.setup({ pdfjs: window.pdfjs }) or some such.

  3. brianmhunt commented on Nov 2, 2018

    @brianmhunt
    Author

    I also noted that the dist/pdfassembler.js includes require statements to a variety of imports e.g.

    head -c 350 node_modules/pdfassembler/dist/pdfassembler.js
    "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var pdf_manager_1=require("pdfjs-dist/lib/core/pdf_manager"),primitives_1=require("pdfjs-dist/lib/core/primitives"),stream_1=require("pdfjs-dist/lib/core/stream"),util_1=require("pdfjs-dist/lib/shared/util"),pako_1=require("pako"),queue=require("promise-queue"),

    I believe pdfassembler would be easier to consume if those modules were actually included, as opposed to require'd.

  4. brianmhunt commented on Nov 2, 2018

    @brianmhunt
    Author

    ... relatedly, I'm sure folks would enjoy a CDN version.

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