13

I just started using nuxt for vue. I added a component in the /components folder and I am trying to use it in one of my pages.

Unfortunately, I get this warning, upon compilation:

"export 'AddPlaceModal' was not found in '~/components/AddPlaceModal.vue'

I am trying to use it via:

<script>
import {mapActions, mapGetters} from 'vuex';
import {AddPlaceModal} from '~/components/AddPlaceModal.vue'; 

export default {
    components: {
        'add-place-modal': AddPlaceModal
    },
...

The component itself looks like:

<script>
export default {
    data() {
        googleLocation: null;
    },
...

Any ideas why this may be?

FailedUnitTest
  • 1,637
  • 3
  • 20
  • 43

2 Answers2

25

You need to import from default export, not a named export

import AddPlaceModal from '~/components/AddPlaceModal.vue';
Aldarund
  • 17,312
  • 5
  • 73
  • 104
  • 2
    Yeah, thank you. If someone interested in what that curly-braces mean, open [that link](https://stackoverflow.com/questions/36795819/when-should-i-use-curly-braces-for-es6-import). – Vlad Oct 11 '19 at 07:52
  • Thanks a lot. I'm used to angular so wasn't understanding why it was not working – Rohan Shenoy Oct 12 '20 at 12:18
14

you have to remove the curly brackets

do this:

Blockquote

instead of:

enter image description here

Madiop Niang
  • 533
  • 4
  • 11