No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    vue-script2 don't work in quasar-framework

    Help
    2
    6
    1626
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • lucassbgomes
      lucassbgomes last edited by

      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
      <Root>

      I used the following tutorial to insert google adsense https://github.com/mazipan/vue-google-adsense

      1 Reply Last reply Reply Quote 0
      • benoitranque
        benoitranque last edited by

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

        1 Reply Last reply Reply Quote 0
        • lucassbgomes
          lucassbgomes last edited by benoitranque

          require(`quasar/dist/quasar.${__THEME}.css`)
          
          require(`quasar/dist/quasar.ie`)
          require(`quasar/dist/quasar.ie.${__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'
          
          Vue.use(Quasar)
          
          Vue.use(require('vue-script2'))
          
          Vue.use(Ads.Adsense)
          Vue.use(Ads.InArticleAdsense)
          Vue.use(Ads.InFeedAdsense)
          
          if (__THEME === 'mat') {
            require('quasar-extras/roboto-font')
          }
          
          new Vue({
            el: '#q-app',
            router,
            render: h => h(require('./App').default)
          })
          
          1 Reply Last reply Reply Quote 0
          • benoitranque
            benoitranque last edited by

            Could you please try modifying the file so it resembles this

            Specifically the Quasar.start function

            1 Reply Last reply Reply Quote 0
            • lucassbgomes
              lucassbgomes last edited by

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

              1 Reply Last reply Reply Quote 0
              • lucassbgomes
                lucassbgomes last edited by

                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!

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post