How to define a loader inline?

Viewed 2591

The docs give an example of a loader here, and the old docs say I should be able to define an "identity loader" by returning what I'm given.

So in theory, adding i => i to my list of loaders (like below) shouldn't break anything.

module: {
    rules: [
        ...
        {
            test: /\.less$/,
            use: [ i => i, ...cssLoaders, lessLoader],
        },
    ]
},

But it causes this error:

/home/me/Projects/myproj/node_modules/enhanced-resolve/lib/Resolver.js:151
    var idxQuery = identifier.indexOf("?");

                         ^
TypeError: Cannot read property 'indexOf' of undefined

Which is not in my code, but must be the result of me giving webpack something unexpected.

So what's the proper syntax for defining a loader (that does nothing) that I can use in the use array like that (without publishing a node module)?

1 Answers
Related