title: How to import functions from different js file in a Vue+webpack+vue-loader project
body: <p>(See end for why this is not a dupe of <a href="https://stackoverflow.com/questions/950087">How do I include a JavaScript file in another JavaScript file?</a>)</p>
  
  <p>Javascipt + Vue + webpack + vue-loader noob... stumbling on the simplest of things! </p>
  
  <p>I have <code>App.vue</code> which has a template:</p>
  
  <pre class="lang-html prettyprint-override"><code>    &lt;template&gt;
       &lt;div id="app"&gt;
           &lt;login v-if="isTokenAvailable()"&gt;&lt;/login&gt;
       &lt;/div&gt;
      &lt;/template&gt;
  </code></pre>
  
  <p>I've declared the <code>isTokenAvailable</code> method in the normal way for Vue inside <code>methods</code>. It uses a function that I wrote in a separate <code>js</code> file:</p>
  
  <pre class="lang-js prettyprint-override"><code>&lt;script&gt;
      import * as mylib from './mylib';
  
      export default {
        ....
          methods:{
              isTokenAvailable: () =&gt; {
                  return mylib.myfunc();
              }
          }
      }
  &lt;/script&gt;
  </code></pre>
  
  <p><code>mylib</code> starts like this:</p>
  
  <pre class="lang-js prettyprint-override"><code>    import models from './model/models'
      import axois from 'axios'
  
      export default function() {
          // functions and constants
      }
  </code></pre>
  
  <p>When I run the project, I get this below warning:</p>
  
  <pre class="lang-js prettyprint-override"><code>    export 'myfunc' (imported as 'mylib') was not found in './mylib'
  </code></pre>
  
  <p>I gather I'm not importing or declaring a javascript module correctly... but there seem to be so many ways to do it, added with the complexity of the scoping in Vue, I'm not sure what is the right way to do it?</p>
  
  <p>Thanks in advance.</p>
  
  <p><strong>Why this isn't a dupe of: <a href="https://stackoverflow.com/questions/950087">How do I include a JavaScript file in another JavaScript file?</a></strong></p>
  
  <p>Doesn't seem to fix the problem, specifically in the context of vuejs.</p>
  
  <p>I have tried this:</p>
  
  <pre class="lang-js prettyprint-override"><code>&lt;script&gt;
      const mylib = require('./mylib');
      ...
  &lt;/script&gt;
  </code></pre>
  
  <p>With the function modified to: <code>exports.myfunc = function()</code></p>
  
  <p><strong>Should I have some other dependency for this to work?</strong> Because I get a different error: </p>
  
  <pre class="lang-sh prettyprint-override"><code>    [Vue warn]: Error in render function:
      TypeError: mylib.myfunc is not a function
  </code></pre>