Skip to content

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

Open
@issacgerges

Description

@issacgerges
  • 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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions