title: How to import a function to a Vue component?
body: <p>I am trying to import a single function to my Vue component. I've created a separated js file for my function:</p>
  
  <p>randomId.js:</p>
  
  <pre><code>exports.randomId = () =&gt; //My function ...
  </code></pre>
  
  <p>In my Vue component, I've imported the Random js:</p>
  
  <pre><code>let randomId = require('../functions/randomId');
  randomId();
  </code></pre>
  
  <p>but Webpack throws an error of "<em>randomId is not a function</em>".
  I tried to import the file using import syntax, but the error remains.</p>
  
  <pre><code>import randomId from '../functions/randomId';
  </code></pre>
  
  <p>Should I use some other methods for importing single functions? I'm relatively new to Webpack and JS6.</p>