变形金刚3 1080p,台州长途汽车站,云霄方芳
今天在初始化项目中,出现了一个奇怪的情况:明明路径是对的,但是编译的时候,一直报“this dependency was not found”的错。
代码如下:
import vue from 'vue' import app from './app' import router from './router' import 'common/stylus/index.styl' /* eslint-disable no-new */ new vue({ el: '#app', render: h => h(app) })
控制台一直报错,表示无法找到common/stylus/index.styl
,然而,路径是通过ide补全填写的,不可能出现错误,那又是为什么?
在网上多番搜索发现,vue中的引入文件时,需要通过./通知编译器是在当前路径,不然的话,第一个文件夹名会被认为是webpack配置的alias(别名)。
所以,正确引入index.styl的方式是:
import vue from 'vue' import app from './app' import router from './router' import './common/stylus/index.styl' // 添加./避免编译器认为是别名 /* eslint-disable no-new */ new vue({ el: '#app', render: h => h(app) })
总结
以上所述是小编给大家介绍的vue中"this dependency was not found"的问题的解决方法,希望对大家有所帮助
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
VUE+elementui组件在table-cell单元格中绘制微型echarts图
Vue通过getAction的finally来最大程度避免影响主数据呈现问题
vue 路由懒加载中给 Webpack Chunks 命名的方法
网友评论