resolveLoader.alias should allow mapping to multiple loaders at once

I’m submitting a feature request

Webpack version:
1.10.x/2.x

Please tell us about your environment:
OSX 10.x / Linux / Windows 10

Current behavior:

Currently you can set up a resolve loader alias like this:

resolveLoader: {
  alias: {
    catalog: 'catalog/lib/loader'
  }
}

This is great if you need to map txt to raw and so on. Useful with RequireJS.

Expected/desired behavior:

It would be better if the idea could be expanded to support loader chains like this:

resolveLoader: {
  alias: {
    catalog: ['catalog/lib/loader', 'raw']
  }
}
  • What is the motivation / use case for changing the behavior?

This would allow to you to alias complicated loader chains to something simpler.

Author: Fantashit

2 thoughts on “resolveLoader.alias should allow mapping to multiple loaders at once

  1. Yeah, I was hoping it would do this as well. The simple use case I have is we use requireCSS and I’d like to write an alias that would use css and style loader. Not sure if there’s a way I could handle that in another way? (without having to write my own loader)

  2. This is a great feature that we are missing right now. A single loader it is pretty useless. What makes webpack a powerful tool is the ability to define pipelines of loaders. So IMHO it is very important to be able to define your loader pipelines once in a config file, name them and reuse them later anywhere in the project.

    Our use case is pretty simple as well:

    • some assets have to be always bundled by default within its chunk;
    • some assets have to be always bundled separately and loaded lazily from the app;
    • all the rest are bundled according to a default configuration.

Comments are closed.