question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Approach to importing in web/ folder makes it complicated to use the files without needless dependencies

See original GitHub issue

Hi, following what one of my users of React-PDF reported in wojtekmaj/react-pdf#183, I’d like to ask you if there’s no better way of importing utils than via the following line:

import { createPromiseCapability } from 'pdfjs-lib';

This is an example from ui_utils.js. If I happen to use ui_utils.js somewhere (in my case by using pdf_link_service.js), it causes the whole, big tree of imports to be created just to get this one function out. If that file imported createPromiseCapability directly from util.js, there wouldn’t be a problem - just one function would be imported where it should, without side effects.

Do you think that’s something that could be solved?

Thanks!

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
dschisslercommented, May 10, 2019

For the last 2.5 years I’ve been hoping that pdf.js would be able to function as a typical node.js package that bundles itself up for the browser using either browserify or webpack. That would probably mean that there are additional subprojects for each of those bundling techniques (or just let me worry about that and to supply my own core-js, etc). I find that pdf.js doesn’t work correctly whatever I do and I end up spending 1-2 days on each major upgrade. I have to try a lot of very hacky stuff to get any results. It seems like there is requirejs (AMD?) stuff, wepback stuff but built with gulp. If I try to source the pdf.js source libraries directly in webpack then I’ll have problems. To some up, I’m quite impressed with pdf.js as a technology but the packaging is just weird, difficult and problematic. The changes over the recent versions are just different kinds of weird, difficult and problematic.

0reactions
wojtekmajcommented, Aug 7, 2018

I’ll happily untangle more modules. 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Imports - Terragrunt - Gruntwork
Define all the code for the single environment in a single file. Implement globals in a way that can be shared across the...
Read more >
Getting error "The file does not contain any projects to import"
If you have any missing dependencies error, you will need to import these custom dependencies manually from the repository folder.
Read more >
How to import an existing directory into Eclipse?
Then right click on the source folder and choose Import... ->General->File system then choose your files, and it will make a copy of...
Read more >
3 Common Tasks — The Yocto Project ® 4.1.999 documentation
Create a Layer Configuration File: Inside your new layer folder, ... The method does not work so well for those new to the...
Read more >
Top 10 Mistakes That Django Developers Make - Toptal
Django is a free and open source Python web framework that helpfully solves common ... 2: Not Pinning Project Dependencies in a requirements.txt...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found