title: How to import Electron in angular 2 using angular cli
body: <p>I'm trying to prototype an Electron app using Angular 2 (configured with the latest webpack-based angular cli) for the gui, but I'm stuck since I don't get how to import Electron api in my angular2 components. Specifically I want to be able to open a new BrowserWindow at the click on a button in the ui... so:</p>
  
  <pre><code>&lt;button type="button" (click)="openNewWindow()"&gt;
      open
  &lt;/button&gt;
  </code></pre>
  
  <p>and in my component:</p>
  
  <pre><code>openNewWindow() {
        let appWindow = new BrowserWindow({width: 800, height: 600});
        appWindow.loadUrl('http://www.google.com');
    }
  </code></pre>
  
  <p>but... how can I import BrowserWindow?!</p>
  
  <p>By using:</p>
  
  <pre><code>import { BrowserWindow } from 'electron';
  </code></pre>
  
  <p>I get a "no module error" and by following the answer to this question: <a href="https://stackoverflow.com/questions/34432695/webpack-cannot-find-module-electron">Webpack cannot find module &#39;electron&#39;</a> I get:</p>
  
  <pre><code>syntax error near unexpected token ( var electron = require('./')
  </code></pre>
  
  <p>What should I do?</p>
  
  <p>ps. by running "<code>electron .</code>" without the <code>BrowserWindow</code> import the app is working properly</p>