title: How to access store context within a plugin in nuxt?
body: <p>I try to add third party code and use it in my Nuxt app. Basically I wrote a plugin under <code>@/plugins/vendorCode/logFn.js</code> which contains a dumb function :</p>
  
  <pre><code>export default ({ store }) =&gt; {
      console.log('store is', store)
  }
  </code></pre>
  
  <p>As you can see I try to access store and perform later some mutation. That's my next step.
  But for now I'm stuck.</p>
  
  <p>In my Vue Component, I've a button calling the logFn, here's what I did :</p>
  
  <pre><code>&lt;script&gt;
  import logFn from '@/plugins/vendorCode/logFn.js'
  
    export default {
      methods: {
        onClick () {
          logFn()
        }
      }
    }
  &lt;/script&gt;
  </code></pre>
  
  <p>So far so good. Once page reload, I can see the result of my logFn in the console, with the store object.</p>
  
  <p><strong>First question : why it is print now ? I did not call it at all.</strong></p>
  
  <p>Then I click the button and got an error : <code>TypeError: Cannot read property 'store' of undefined</code>. </p>
  
  <p><strong>Second question : why this error regarding the log I had previously?</strong></p>
  
  <p>Thank you for your help</p>