title: How to import a external function in a Vue component?
body: <p>I'm a newbie in javascript and vue.js and I'm facing somme issue when trying to add a new function in an existing programme.</p>
  <p>I have put my new function (with others) in a separate file:</p>
  <pre><code>export const MyFunctions = {
  MyFunction: function(param) {
      // Doing stuff
  }
  }
  </code></pre>
  <p>Then I import the file in the component file and calling my function :</p>
  <pre><code>&lt;script&gt;
      import {MyFunctions} from &quot;@/components/MyFunctions.js&quot;;
      export default {
          name:&quot;Miniature&quot;,
          computed: {
              useMyFunction() {
                  MyFunction(&quot;Please do some stuff !&quot;);
              }
          }
      }
  &lt;/script&gt;
  </code></pre>
  <p>When the component is used, I get an error message</p>
  <blockquote>
  <p>[Vue warn]: Property or method &quot;MyFunction&quot; is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property. See: <a href="https://v2.vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties" rel="nofollow noreferrer">https://v2.vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties</a>.</p>
  </blockquote>
  <p>I've read a lot of documentation and fail to understand why it doesn't work. Can anyone help me with this ??</p>