Skip to content

Using webpack specific properties decreased loader's compatibility. #1401

Closed
@malash

Description

@malash

Bug report

In the latest version of css-loader ( 6.5.1 ), there are several lines of code that used webpack specific properties in loader context, like,

loaderContext._compilation.options.devtool.includes("nosources")

and

loaderContext._compiler.webpack.util.createHash(hashFunction);

and

let result = loaderContext._compilation.getPath(localIdentName, data);

These usage cause css-loader became less compatible. For example, when using css-loader with thread-loader, the loader fails to run because of missing properties.

Actual Behavior

When using css-loader with thread-loader, this error occurred.

image

Expected Behavior

css-loader should not depends on any webpack specific properties.

How Do We Reproduce?

{
  use: [
    MiniCssExtractPlugin.loader
    'thread-loader',
    'css-loader',
  ]
}

Please paste the results of npx webpack-cli info here, and mention other relevant information

N/A

Refs

Same issue in thread-loader: webpack-contrib/thread-loader#66

Similar issue in previous: #1281

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