title: Access a Global Variable in Main File with an Imported Javascript Function ES6
body: <p>I am using <code>Vue.js</code> but with simply <code>JS</code> files and not <code>vue</code> files and I am importing a component into my main <code>app.js</code> like so:</p>
  
  <pre><code>import autoPosts from './components/autoPosts.js';
  </code></pre>
  
  <p>It imports it just fine, but I am trying to access these globals. Before people destroy me for using global variables, can you just tell me if this is possible.</p>
  
  <pre><code>const apiRoot    = location.origin + '/wp-json/wp/v2/';
  const acfApiRoot = location.origin + '/wp-json/acf/v3/';
  
  import autoPosts from './components/autoPosts.js';
  </code></pre>
  
  <p>It doesn't read <code>apiRoot</code> or <code>acfApiRoot</code> within that component whether I include it before or after the variables.</p>
  
  <p>The only way it works is if I declare the variables inside my component file <code>autoPosts.js</code></p>