Vue 中使用 less 报错 Module build failed: TypeError: loaderContext.getResolve is not a function

1. Less error report 1
Restate the steps of use

1、安装 npm install less less-loader --save

2. Configuration, added under the rules node of webpack.base.conf.js:

{ test: /.less$/, loader: “style-loader!css-loader!less-loader” } 3. Use, use lang=“less” in the style tag



4. Compile and run, and an error may be reported at this time:

Module build failed: TypeError: loaderContext.getResolve is not a function

5. Solve

This error is generally caused by the too high version of less-loader, the version number can be checked in package.json;

Uninstall the original npm uninstall less-loader;

Install the specified version npm install [email protected] --save

Guess you like

Origin blog.csdn.net/qq_41454044/article/details/106711677