pdf.js import undefined for web component

I am trying to write a web component using lit-html which will render a user selected PDF file using pdf.js. However pdf.js import gives me the following error:

import 'pdfjs-dist/build/pdf.js';

TypeError: "root is undefined"
    webpackUniversalModuleDefinition http://localhost:8003/node_modules/pdfjs-dist/build/pdf.js:21
    <anonymous> http://localhost:8003/node_modules/pdfjs-dist/build/pdf.js:21

I can render a pdf file if I use a script tag for pdf.js in an html file.

43 thoughts on “pdf.js import undefined for web component”

  1. I simply couldn’t leave your web site prior to
    suggesting that I extremely enjoyed the standard
    info an individual supply in your guests?
    Is gonna be again continuously in order to investigate cross-check new posts

    Reply
  2. I like the helpful information you provide in your
    articles. I’ll bookmark your blog and check again here frequently.
    I’m quite sure I’ll learn plenty of new stuff right here!

    Best of luck for the next!

    Reply
  3. With havin so much written content do you ever run into
    any problems of plagorism or copyright infringement?
    My site has a lot of exclusive content I’ve either created myself or
    outsourced but it seems a lot of it is popping it up all over the web without my
    permission. Do you know any methods to help prevent content from being stolen? I’d really appreciate it.

    Reply
  4. Definitely believe that which you said. Your favorite justification appeared to be on the internet the simplest thing to be aware of.
    I say to you, I definitely get annoyed while people think
    about worries that they plainly don’t know about.
    You managed to hit the nail upon the top and defined out the whole thing without
    having side-effects , people can take a signal. Will probably be back to get more.
    Thanks

    Reply
  5. I really like your blog.. very nice colors & theme. Did you design this website yourself or did you hire someone to do it for you?
    Plz reply as I’m looking to construct my own blog and would like to find out where u got this from.
    appreciate it

    Reply
  6. What’s Taking place i’m new to this, I stumbled upon this I have
    found It absolutely useful and it has aided me out loads.
    I’m hoping to contribute & assist different customers like
    its aided me. Great job.

    Reply
  7. Excellent post. I was checking continuously this weblog
    and I’m inspired! Extremely useful information specially the ultimate phase :
    ) I take care of such information a lot. I was looking for this particular information for a very lengthy time.
    Thank you and good luck. ps4 games https://bitly.com/3z5HwTp ps4 games

    Reply

Leave a Comment