Vue项目style样式层下载less-loader时候遇到的坑

vue

vue的项目中使用lang=”less“在安装less-loader的时候经常会因为版本过高报错

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

at createWebpackLessPlugin (C:\Users\EDZ\Desktop\nsf_enterprise\nsf_enterprise\node_modules\less-loader\dist\utils.js:31:33)

at getLessOptions (C:\Users\EDZ\Desktop\nsf_enterprise\nsf_enterprise\node_modules\less-loader\dist\utils.js:148:31)

at Object.lessLoader (C:\Users\EDZ\Desktop\nsf_enterprise\nsf_enterprise\node_modules\less-loader\dist\index.js:29:49)

@ ./node_modules/vue-style-loader!./node_modules/css-loader?{"sourceMap":true}!./node_modules/vue-loader/lib/style-compiler?{"vue":true,"id":"data-v-3d5f66de","scoped":true,"hasInlineConfig":false}!./node_modules/less-loader/dist/cjs.js?{"sourceMap":true}!./node_modules/vue-loader/lib/selector.js?type=styles&index=0!./src/components/order/allOrder.vue 4:14-385 13:3-17:5 14:22-393

@ ./src/components/order/allOrder.vue

@ ./src/router/index.js

@ ./src/main.js

@ multi (webpack)-dev-server/client?http://localhost:8080 webpack/hot/dev-server ./src/main.js

通常是因为安装了最新版本的less-loader导致的。只需按照指定版本即可解决

npm i less-loader@4.1.0

问题解决好了OK

以上是 Vue项目style样式层下载less-loader时候遇到的坑 的全部内容, 来源链接: utcz.com/z/376428.html

回到顶部