Since merging "PDFLab" into GitLab's repo (!10642 (merged)), we've had a few odd problems:
We're referencing Mozilla's PDF library inconsistently. We're referencing the main script through the npm-installed module:
import pdfjsLib from 'pdfjs-dist';
and we're referencing the service worker from our
import workerSrc from 'vendor/pdf.worker';
They are actually different versions of the library. (npm module is
1.8.252, and vendored worker script is
We still have the compiled 422kb
pdflab.jslibrary in our
The way we were compiling the service worker in our assets (with
file-loader) does not uglify the output so we are serving a 1.5Mb un-minified script in production.
The worker file output by
file-loaderhas an ambiguous filename that ends up looking like
pdfjs-distnode module depends on
worker-loaderwhich has a hard
peerDependencywith webpack v2.X. This is preventing us from upgrading to webpack v3 !12298 (merged).
This MR addresses all of these by updating our settings, and vendoring all of the pdfjs-dist assets into
Once https://github.com/webpack-contrib/worker-loader/issues/75 is resolved, we can use the node module again for both the service worker and the main lib.