vue2 less-loader无效解决

安装时报警告

less-loader@10.2.0 requires a peer of webpack@^5.0.0 but none is installed. You must install peer dependencies yourself.

项目中使用less样式时报错

ERROR Failed to compile with 1 error
error in ./src/App.vue?vue&type=style&index=0&lang=less&
Syntax Error: TypeError: this.getOptions is not a function

因为vue脚手架使用webpack4版本,less-loader8以上版本需要webpack5
安装less-loader7版本即可

npm i less-loader@7 less

posted on 2022-04-11 22:37  路过君  阅读(228)  评论(0编辑  收藏  举报

导航