Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incompatibility with css-loader due to its use of createHash #208

Open
issacgerges opened this issue Mar 18, 2024 · 2 comments
Open

Incompatibility with css-loader due to its use of createHash #208

issacgerges opened this issue Mar 18, 2024 · 2 comments

Comments

@issacgerges
Copy link

  • Operating System: MacOS
  • Node Version: 20
  • NPM Version: 10.5.0
  • webpack Version: 5.90.3
  • thread-loader Version: 4.0.2

Expected Behavior

thread-loader is compatible with css-loader

Actual Behavior

The following exception is raised at runtime

Cannot read properties of undefined (reading 'util')
    at PoolWorker.fromErrorObj (/some_dir/node_modules/thread-loader/dist/WorkerPool.js:302:12)
    at /some_dir/node_modules/thread-loader/dist/WorkerPool.js:184:29
    at /some_dir/foo/bar/file.less:1:1
    at defaultGetLocalIdent (/some_dir/node_modules/css-loader/dist/utils.js:323:37)

Code

css-loader expects to be able to create hashes via an exposed loader/webpack api. thread-loader doesn't expose these over the processes bridge so hitting this code will always errror.

How Do We Reproduce?

Specifying any of the localIdent configuration options on css-loader and running it in thread-loader should be enough to repro.

Additional questions

I reported this as a bug since it seemed previously compatibility with css-loader was intended. If that's still the case, is there a better way for them to create hashes?

@issacgerges issacgerges changed the title Incompatibility with css-loader Incompatibility with css-loader due to its use of createHash Mar 18, 2024
@alexander-akait
Copy link
Member

We need to pass util api to to loader context, feel free to send a PR

@alexander-akait
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants