Static GitHub Issues

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

prev: proxy not work in nginx server
next: Backslash in paths to *.js resources

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
<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This question is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c1542">#c1542</a>)</em></sub></div>