title: How to use global JS variables with Laravel Mix?
body: <p>I am using Laravel Mix and I have an issue with the global variables.</p>
  <p>In the app.js file I have the following:</p>
  <pre><code>import $ from 'jquery';
  window.$ = window.jQuery = $;
  
  var iniciateUserChoiceBool = false;
  
  $(function() {
     require('./functions');
     require('./tabs');
  });
  </code></pre>
  <p>The variable in question <code>iniciateUserChoiceBool</code> I am using in functions.js and in tabs.js and I need it to be the same variable. But every time I am getting:</p>
  <pre><code>Uncaught ReferenceError: iniciateUserChoiceBool is not defined
  </code></pre>
  <p>If I put the variable in the different files in functions.js and in tabs.js the error is gone, but functionality changes as the variables are not the same and the <code>if</code> statement differs. How can I use global variables with Laravel mix?</p>
  <p>I also tested it like this, still getting an error.</p>
  <pre><code>import $ from 'jquery';
  window.$ = window.jQuery = $;
  
  $(function() {
     var iniciateUserChoiceBool = false;
  
     require('./functions');
     require('./tabs');
  });
  </code></pre>