webpack 下在main.js 中全局引入less 文件淘这,一直報錯:
ERROR Failed to compile with 1 errors 14:42:19
error in ./src/style/common.less
Module build failed:
// load the styles
var content = require("!!../../node_modules/css-loader/index.js??ref--10-1!../../node_modules/postcss-loader/lib/index.js??ref--10-2!../../node_modules/less-loader/dist/cjs.js??ref--10-3!./common.less");
^
Unrecognised input
in /src/style/common.less (line 4, column 12)
@ ./src/style/common.less 2:14-329 21:1-42:3 22:19-334
@ ./src/style/index.js
@ ./src/main.js
@ multi (webpack)-dev-server/client?http://localhost:8080 webpack/hot/dev-server ./src/main.js
原因:
當前項目版本(Vue 2.9.6
)已經(jīng)在build/utils
里配置里less的處理雇寇。所以之前在build/webpack.base.conf.js
配置的less-loader
沖突了否纬。結(jié)果報錯虱黄。
utils
里的默認配置:
之前build/webpack.base.conf.js
配置:
去掉
build/webpack.base.conf.js
紅框里的less的loader 的配置就行了蹬刷。