Config loader chaining with ! in Webpack 2

Do you want to request a feature or report a bug?
Bug, I guess?

What is the current behavior?
Chaining loaders with ! results in Module not found: Error: Can't resolve 'style-loader!css-loader!less-loader' (i.e: use: 'style-loader!css-loader!less-loader').

This issue started out in a tweet from me to @TheLarkInn and was followed by a
gist with examples where I asked if ! loader chaining should work in Webpack 2. I’m under the impression it should still work.

If the current behavior is a bug, please provide the steps to reproduce.
I’ve setup a quite stripped branch, with two commits where one example works and the other does not. Both are discussed in the gist linked above. Should both work in Webpack 2?
Working (other working examples are mentioned in the gist):
jouni-kantola/webpack-output-by-build-type@73b5473

Broke (other broke examples are mentioned in the gist):
jouni-kantola/webpack-output-by-build-type@4844e85

What is the expected behavior?
I’m not sure, as I don’t know if ! should work when using:

module: {
    rules: [
      {
        test: /\.less$/,
        use: 'style-loader!css-loader!less-loader'
      }
    ]
  }

I guess that is a part of this issue, whether ! chaining should work when configured in webpack.config.js. I can’t find any references to this in the new docs.

Please mention other relevant information such as the browser version, Node.js version, Operating System and programming language.
OS: MacOS Sierra (10.12.1)
Node: v6.8.0
Deps:

"devDependencies": {
    "html-webpack-plugin": "^2.24.1",
    "inline-manifest-webpack-plugin": "^3.0.1",
    "webpack": "^2.2.0-rc.3",
    "webpack-dev-server": "^2.2.0-rc.0",
    "webpack-manifest-plugin": "^1.1.0",
    "style-loader": "^0.13.1",
    "css-loader": "^0.26.1",
    "less": "^2.7.1",
    "less-loader": "^2.2.3"
  }

Author: Fantashit

1 thought on “Config loader chaining with ! in Webpack 2

Comments are closed.