Home

Issue: 1718

[NOT AN ISSUE|QUESTION] How to load a non VueJS plugin ?

[issue link]

Hi !

I’m sorry for posting an issue… that is not an issue 😦

I want to use an external library (HelloJS - a client side OAuth lib) in my project. In order to use it I have a bit of configuration to do, like settings my API keys etc…

I’ve created a hello.js (code at the end of the post) file in the plugins/ folder in order to use it, but it’s not VueJS plugin. How can I use this plugin ? I tried to simply import it in my page, but this plugin use “window” and it crash when the page is being rendered by SSR.

/nuxt.config.js

module.exports = {
  //...
  plugins: [{src: '~/plugins/hello.js', ssr: false}],
  //...
}

/plugins/hello.js

import hello from 'hellojs'

hello.init({-removed-})

export default hello
This question is available on Nuxt.js community (#c1542)