vue-script2 don't work in quasar-framework

  • Hi everyone, I’m having a problem, I’m developing an application and I need to use vue-script2 to be able to add google adsense to the project. But when I use vue-script2 in the quasar it returns the error described below, and the same code without the quasar-framework works, can anyone help?

    [Vue warn]: You are using the runtime-only build of Vue where the template compiler is not available. Either pre-compile the templates into render functions, or use the compiler-included build.

    found in

    —> <Script2>
    <Hello> at src/components/Hello.vue
    <App> at src/App.vue

    I used the following tutorial to insert google adsense

  • Could you please post the content of your src/main.js file?

  • require(`quasar/dist/quasar.${__THEME}.css`)
    import Vue from 'vue'
    import Quasar from 'quasar'
    import router from './router'
    import 'quasar-extras/material-icons'
    import 'quasar-extras/ionicons'
    import 'quasar-extras/fontawesome'
    import Ads from 'vue-google-adsense'
    if (__THEME === 'mat') {
    new Vue({
      el: '#q-app',
      render: h => h(require('./App').default)

  • Could you please try modifying the file so it resembles this

    Specifically the Quasar.start function

  • It does not work, I’m using the pwa model, does it have another setting?

  • Good night, after a lot of reading, testing, I was able to solve the problem, I discovered that for some reason browsers forbid the use of new Function (), I do not know if it’s because of CSP or some other security policy, but my naivety (novice in vue and quasar) did not realize that in the alias of the webpack of quasar (./config/index.js) did not have this alias that by default exists in the templates of vue without quasar:

    ‘vue $’: ‘vue / dist / vue.esm.js’

    When insert this line, vue-script2 worked 100%. I leave this solution to help.

    Problem solved!

Log in to reply