“is not defined” in Nuxt.js

5.4k views Asked by At

i'm working on a Single page Application using Vuejs and Nuxtjs and i want to add a external js file to my project i added the below code to my nuxt.config.js file

script: [
  { src: '****/wialon.js', body: true }
]

and in the default.vue file in mounted() this code

mounted () {
  wialon.core.Session.getInstance().initSession('***') // init session
}

and i got this error when i npm run dev

'wialon' is not defined

but when i try to build this app (npm run build) and copy the files to my server or local host it is working!!

can you please help me with this.

Thanks.

0

There are 0 answers