I'm writing a custom loader for webpack.
Within my loader I've got a require string like this:
"css!less!./myFile.less"
Is there a way to get the output of the resolved request?
I'm looking for the output of the module after all loaders have been applied. Or in other words:
How do I get the compiled css from the string above?
I tried to use this.resolve on the loader context:
this.resolve(this.context, "css!less!./myFile.less", function(err, result){
// Best case scenario so far:
// result == "./myFile.less"
// How do I get the css from myFile.less here?
// Is that even possible/the right way to get this?
});
But I can't seem to get the resolved output. I'm probably doing something wrong, the only documentation I've found about this function is here: http://webpack.github.io/docs/loaders.html#resolve
There is a (so far) undocumented method:
this.loadModule(request, callback:function(err, source));
This method will load the module and apply all loaders before calling the callback.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With