webpack初体验之less,less-loader报错

使用webpack打包less文件时出现以下问题,主要是原因是因为less-loader和webpack版本不兼容,我使用的是[email protected],最新版本的[email protected]只支持[email protected]以上。

ERROR in ./node_modules/css-loader/dist/cjs.js!./node_modules/less-loader/dist/cjs.js!./src/css/special.less
Module build failed: TypeError: loaderContext.getResolve is not a function
    at createWebpackLessPlugin (D:\HBuilderX\workspace\webpackdemo\webpackdemo\node_modules\less-loader\dist\utils.js:30
:33)
    at getLessOptions (D:\HBuilderX\workspace\webpackdemo\webpackdemo\node_modules\less-loader\dist\utils.js:147:28)
    at Object.lessLoader (D:\HBuilderX\workspace\webpackdemo\webpackdemo\node_modules\less-loader\dist\index.js:29:49)
 @ ./src/css/special.less 2:26-138
 @ ./src/main.js

你可能感兴趣的:(webpack,vue,less)