Reputation: 1500
I have the similar folder structure as shown below
/components/organisms
-- ModuleA.vue
-- ModuleB.vue
-- index.js
content of index.js
export { default as ModuleA } from "./ModuleA.vue"
export { default as ModuleB } from "./ModuleB.vue"
If I try to import ModuleB into ModuleA, it generates an error
ModuleA.vue
content
<script>
import { ModuleZ } from '@/components/molecules' // component from another directory, it works perfectly
import { ModuleB } from '@/components/organisms' // can't find, error
</script>
Upvotes: 0
Views: 639
Reputation: 18834
You cannot have an cyclic dependency structure with imports.
This generates undefined behaviour when bundled with webpack, usually manifesting as 1 of the files becoming undefined
Upvotes: 1