title: d3.event is null in modular d3 project
body: <blockquote>
    <p><strong>Note</strong>: I found an answer to this question
    <a href="https://stackoverflow.com/a/40304080/2928853">here</a>. The problem is
    solved; no need for more answers!</p>
  </blockquote>
  
  <p>I am doing a project with the following structure:</p>
  
  <pre><code>root
  |
  |____js
  |     |__index.js
  |
  |__node_modules
  |             |__d3-*
  |             
  |
  |__index.html
  |__package.json
  </code></pre>
  
  <p>index.html:</p>
  
  <pre><code>&lt;head&gt;
      &lt;script src="https://unpkg.com/getlibs"&gt;&lt;/script&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  &lt;div id="detail"&gt;&lt;/div&gt;
  &lt;/div&gt;
  &lt;!--script type="module" src="./js/index.js"&gt;&lt;/script&gt; Also tried this method --&gt;
  
  &lt;script&gt;
      System.import('./js/index.js');
  &lt;/script&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>index.js:</p>
  
  <pre><code>import {select} from "d3-selection";
  import {event as currentEvent} from "d3-selection";
  let svg = select('#detail')
          .append('svg')
          .attr('width', 500)
          .attr('height', 500);
          svg.on('click', function() {
              console.log(window.event);
              console.log(currentEvent);
           });
  </code></pre>
  
  <p>And the output is:</p>
  
  <pre><code>MouseEvent {isTrusted: true, screenX: 266, screenY: 247, clientX: 266, clientY: 175, …}
  null
  </code></pre>
  
  <p>If I use d3 globally through a script tag, referring to it inside the module via <code>window.d3</code>, then <code>d3.event</code> correctly catches the mouse event. I want to create a modular project and avoid having a global d3 object. </p>
  
  <p>Is that achievable, and if so, how?</p>