Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Simple vue component returns "Uncaught SyntaxError: import not found: default"

Not sure what I’m doing wrong here, I’m breaking some large components down into smaller components, and I’ve just created a component that is mostly empty like so:

<div>
  test
</div>

<script>
  export default {
    data() {}
  }
</script>

I call it in the parent component using <my-new-component /> (which works with all other components.)

And in the parent component’s script tag I have

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

import MyNewComponent from "path"; // everything directs correctly when I click on the component name and path in my IDE

export default {
  components: {
    MyNewComponent
  }
}

I can’t get rid of the Uncaught SyntaxError: import not found: default within the MyNewComponent.vue file

This is how I’m using all my other components, what am I forgetting here? I’m on Vue 2.7

>Solution :

You need to wrap your HTML section in a template tag.

<template>
  <div>
    test
  </div>
</template>

<script>
  export default {
    data() {}
  }
</script>
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading