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.

Error: Cannot find module 'worker-loader!./build/pdf.worker.js'

See original GitHub issue
import pdfjs from "pdfjs-dist/webpack.js";

results in:

Error: Cannot find module ‘worker-loader!./build/pdf.worker.js’

npm list webpack worker-loader pdfjs-dist

+-- pdfjs-dist@2.0.943 
| `-- worker-loader@2.0.0  deduped
+-- webpack@4.35.0 
`-- worker-loader@2.0.0 

What could be a reason for that? The suggestion was:

You can use the pdfjs-dist/webpack module for PDF.js autoconfiguration. 😄

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:7
  • Comments:14 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
zdmcommented, Mar 25, 2020

@timvandermeij
so, how we can use it now? import pdfjs from "pdfjs-dist/webpack.js"; not works already.

2reactions
tgbvcommented, Jun 5, 2020

Install worker-loader and try again:

npm install worker-loader --save-dev
Read more comments on GitHub >

github_iconTop Results From Across the Web

Issues - GitHub
build/pdf.worker.js' Error: Cannot find module 'worker-loader!./build/pdf.worker.js' at Function.Module._resolveFilename (module.js:485:15) ...
Read more >
Looking for help to make npm/pdfjs-dist work with Webpack ...
Module not found: Error: Can't resolve 'module' in ... Which is attempting to load pdf.worker.js (which worker-loader should be packaging) ...
Read more >
Compile and set the worker source with Webpack
This post demonstrates a simple way that uses the Webpack bundler to compile and set up the worker source based on the current...
Read more >
worker-loader - webpack - JS.ORG
webpack is a module bundler. Its main purpose is to bundle JavaScript files for usage in a browser, yet it is also capable...
Read more >
Using worker_threads in Node.js - Medium
throw err; ^Error: Cannot find module 'worker_threads' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:603:15) at Function.Module.
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