用vue-cli 脚手架构建的项目,sytle 是用less,组件里面用less mixin 传入url 引用背景图,地址就是和组件同一目录。编译后的路径不对。
项目目录
mixin.less
header.vue
直接报错,路径指向了less目录
ERROR in ./~/css-loader!./~/vue-loader/lib/style-rewriter.js?id=data-v-7baeb122!./~/less-loader!./~/vue-loader/lib/selector.js?type=styles&index=0!./src/components/header/header.vue
Module not found: Error: Can't resolve '../../common/less/brand@3x.png' in 'E:\project\sellapp\src\components\header'
@ ./~/css-loader!./~/vue-loader/lib/style-rewriter.js?id=data-v-7baeb122!./~/less-loader!./~/vue-loader/lib/selector.js?type=styles&index=0!./src/components/header/header.vue 6:749-790
@ ./~/vue-style-loader!./~/css-loader!./~/vue-loader/lib/style-rewriter.js?id=data-v-7baeb122!./~/less-loader!./~/vue-loader/lib/selector.js?type=styles&index=0!./src/components/header/header.vue
@ ./src/components/header/header.vue
@ ./~/babel-loader/lib!./~/vue-loader/lib/selector.js?type=script&index=0!./src/App.vue
@ ./src/App.vue
@ ./src/main.js
@ multi ./build/dev-client ./src/main.js
请问如何解决该问题 ,最好不要加那么一长串路径