Webpack2 loading and extracting LESS file

£可爱£侵袭症+ 提交于 2019-12-06 01:29:47

Ok.. got it working with:

 loader: ExtractTextPlugin.extract({ 
     loader:[ 'css', 'less' ], 
     fallbackLoader: 'style-loader' 
 })

Edit This was for Webpack v2 - thanks to @thelastshadow for note on Webpack 4 issue here.

You perhaps also need to use an additional load like the style- or css-loaders. From the Docs:

var css = require("!raw!less!./file.less");
// => returns compiled css code from file.less, resolves imports
var css = require("!css!less!./file.less");
// => returns compiled css code from file.less, resolves imports and url(...)s

The less-loader just handles the processing into CSS. Webpack then needs to know how to incorporate the CSS before it's extracted back out.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!