[Vuejs]-Issues using external components with nuxt

3👍

I think you have to add transpile build option since vuetify-google-autocomplete use ES6 module. Please see ES6 plugins for more about detail.

So your nuxt.config.js should be:

export default {
  build: {
    transpile: ['google-autocomplete']
  },
  plugins: [
    '@/plugins/vuetify',
    '@/plugins/google-autocomplete'
  ]
}

0👍

In addition to the answer of above, if you are facing this while writing your own plugin with a dependency to an external package. You could choose to write a Nuxt module instead of a plugin. This way you can add the plugin code and transpile settings in one go instead of manually adding this (and potentially forget) to nuxt.config.js

Leave a comment