我使用此tutorial在Vue中创建了一个库,该库可以正常工作。但是问题来了,我安装了该库并将模块导入到使用yarn add ../vue-okra
,然后将其导入到现有的vue文件中,如下所示:import OkraButton from 'vue-okra'
请参见下面的完整代码段:
<template>
<div id="app">
<img alt="Vue logo" src="./assets/logo.png">
<HelloWorld msg="Welcome to Your Vue.js App"/>
</div>
</template>
<script>
import HelloWorld from './components/HelloWorld.vue'
import OkraButton from 'vue-okra'
export default {
name: 'app',
components: {
HelloWorld
}
}
</script>
<style>
#app {
font-family: 'Avenir', Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
margin-top: 60px;
}
</style>
当我在该项目上运行纱线服务以查看库是否在该项目中运行时,出现错误:
> This dependency was not found: * vue-okra in ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/App.vue?vue&type=script&lang=js&
我看到了这个question,但似乎并没有太大帮助。拜托,我在做什么错了?