alex-oleshkevich / vue-introjs

intro.js bindings for Vue.
MIT License
301 stars 53 forks source link

window is not defined - nuxt #21

Closed AshwinTayson closed 6 years ago

AshwinTayson commented 6 years ago

This throws an error while using with nuxt.js. Since nuxt doesn't use webpack explicitly there is no way to define it the same way.

I'm trying to declare vue-introjs as a plugins in vuex.

alex-oleshkevich commented 6 years ago

https://nuxtjs.org/faq/extend-webpack/

AshwinTayson commented 6 years ago

Can you give an example of how to use with nuxt?

I tried declaring it as plugins since it is similar to webpack.providePlugin. It throws an error Unexpected token import

AshwinTayson commented 6 years ago

Okay I solved it using

nuxt.config.js

const webpack = require('webpack')
build: {
    plugins: [
      new webpack.ProvidePlugin({
        'introJs': ['intro.js', 'introJs']
      })
    ]
  }

and restart the server. Its documented in https://nuxtjs.org/faq/webpack-plugins

AshwinTayson commented 6 years ago

But now it complains about this.$intro() is not a function on initialising. Can you please help?

alex-oleshkevich commented 6 years ago

seems like you did not correctly registered this plugin in vue.

On Thu, Apr 26, 2018 at 9:04 AM, Ashwin A notifications@github.com wrote:

But now it complains about this.$intro() is not a function on initialising. Can you please help?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/alex-oleshkevich/vue-introjs/issues/21#issuecomment-384523748, or mute the thread https://github.com/notifications/unsubscribe-auth/AAmzyJ3-HdVdagb1-GJHJbbu_dnACLk3ks5tsWOEgaJpZM4TjDeQ .

-- Sincerely, Alex Oleshkevich