Skip to content

Unable to build with webpack 5 #12641

@Qualphey

Description

@Qualphey

I am trying to use pdfjs-dist in a webpack script:

const PDFJS = require("pdfjs-dist/webpack");

var loadingTask = PDFJS.getDocument('hello.pdf');
loadingTask.promise.then(function(pdf) {
  console.log(pdf);
  // you can now use *pdf* here
});

Though it fails to build dumping an error:

./node_modules/worker-loader/dist/cjs.js!./node_modules/pdfjs-dist/build/pdf.worker.js
ModuleBuildError: Module build failed (from ./node_modules/worker-loader/dist/cjs.js):
Error: MainTemplate.hooks.hotBootstrap has been removed (use your own RuntimeModule instead)

I understand that MainTemplate.hooks.hotBootstrap has been removed in webpack 5, but is there a workaround for this? Are there any plans to support the latest webpack version?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions