[英]vue-jest related: Cannot find module 'vue' from
As it shows in the picture, I have two projects that share some vue components.如图所示,我有两个项目共享一些 vue 组件。
I import ImageBlock.vue in my Card.vue component, it works fine.我在 Card.vue 组件中导入 ImageBlock.vue,它工作正常。 But when I write test cases for Card component, I got the error但是当我为 Card 组件编写测试用例时,我得到了错误
> Cannot find module 'vue' from '../sharedComponents/ImageBlock.vue'
I searched, couldn't find any answers.我搜索了,找不到任何答案。 How can I solve this?我该如何解决这个问题?
I think the path from your test directory is wrong.我认为您的测试目录的路径是错误的。 If your test is in project2/test
,如果您的测试在project2/test
中,
you should try importing from ../../sharedComponents/ImageBlock.vue
您应该尝试从../../sharedComponents/ImageBlock.vue
导入
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.