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.

Module not found: Can't resolve 'worker_threads' - libsquoosh

See original GitHub issue

I am trying to use squoosh/lib in my react app but I am getting the following error

Failed to compile.
./node_modules/@squoosh/lib/build/index.js
Module not found: Can't resolve 'worker_threads' in  'path/to/@squoosh/lib/build

has anyone else been running into this issue?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
surmacommented, Jun 30, 2021

Yeah, I can see that. We wrote squoosh.app, then we wrote a Squoosh CLI. Both completely independent and separate (although they do share the Wasm code). @atjn then extracted libsquoosh from the CLI, so that other build tools like Webpack, rollup etc could potentially make use of the image compression capabilities without having to shell out.

Squoosh the PWA remains independent, tho. The main reason is that very different approaches are valid in Node but not valid on the Web (mostly related to file size and lazy loading).

0reactions
kosamaricommented, Jul 1, 2021

Let’s continue this on #1084

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot find module: avif_node_enc_mt.worker-be931951.js ...
Describe the bug I wanted to try running cli on Win10 but I got error: PS C:\Users\konta> squoosh-cli --avif "{speed:5,cqLevel:18 ...
Read more >
Cannot find module 'worker_threads' error in production
The code works fine when I run npm start in VS Code. But when build and copied in Ubuntu server, it show "Cannot...
Read more >
Node.js multithreading with worker threads series - Snyk
The worker_threads module implements a form of threading that lets you add parallelism to your own application. Code executed in a worker thread...
Read more >
Cannot find module 'worker_threads' - Glitch Support
I am getting such an error? In this project, I will make a bot and a site with Node.js and Express. I opened...
Read more >
ImageMinimizerWebpackPlugin | webpack
sharp - High performance Node.js image processing, the fastest module to resize and compress JPEG, PNG, WebP, AVIF and TIFF images. Uses the...
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