3

folder structure

As it shows in the picture, I have two projects that share some vue components.
I import ImageBlock.vue in my Card.vue component, it works fine. But when I write test cases for Card component, I got the error

> Cannot find module 'vue' from '../sharedComponents/ImageBlock.vue'

I searched, couldn't find any answers. How can I solve this?

themoonpie
  • 31
  • 3

1 Answers1

0

I think the path from your test directory is wrong. If your test is in project2/test,

you should try importing from ../../sharedComponents/ImageBlock.vue

Ibrahim
  • 13
  • 3
  • The path is not the problem. That component is imported correctly, and I don't need to import it in the test file. It's something else. – themoonpie Sep 09 '22 at 16:13