我是一名为webpack编写自定义加载器的开发者。
在我的加载器中,我有一个类似于这样的require字符串:
"css!less!./myFile.less"
有方法获取解析请求的输出吗?
我正在寻找模块应用所有加载器后的输出结果。换句话说:
如何从上述字符串中获取编译后的CSS?
我尝试在加载器上下文中使用 this.resolve
:
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?
});
但是我似乎无法获得解析后的输出。我可能做错了什么,我找到的有关此函数的唯一文档在这里:http://webpack.github.io/docs/loaders.html#resolve。