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,403
  • 1
  • 21
  • 33

2 Answers2

26

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

import AddPlaceModal from '~/components/AddPlaceModal.vue';
Aldarund
  • 16,410
  • 5
  • 68
  • 98
  • 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
13

you have to remove the curly brackets

do this:

Blockquote

instead of:

enter image description here

zahafyou
  • 493
  • 4
  • 11