title: Electron together with live mode in Angular isn't loading node_module resources
body: <h1>Context</h1>
  <p>I'm writing an application with Electron and Angular 2+ using Angular CLI. I've set up my electron .js file to point to the URL provided by the <code>ng serve</code> command, that usually is <code>localhost:4200</code>, in order to capture the code changes. Some considerations:</p>
  <ul>
  <li>The address <code>localhost:4200</code> points to <code>index.html</code>;</li>
  <li><code>index.js</code> is my Electron entry point script</li>
  </ul>
  <p>Here is my <code>index.js</code> file used as an entry point for the electron module.</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>const {app, BrowserWindow} = require('electron');
  const url = require('url');
  const path = require('path');
  
  let win = null;
  
  function createWindow() {
    win = new BrowserWindow({width: 1000, height: 600, show: false});
    win.loadURL('http://localhost:4200');
  
    win.maximize();
    win.on('closed', () =&gt; {
      win = null;
    });
    win.on('ready-to-show', () =&gt; {
      win.show();
    });
    win.webContents.openDevTools();
  }
  
  app.on('ready', () =&gt; {
    createWindow();
  });
  
  app.on('activate', () =&gt; {
    if (win === null) {
      createWindow();
    }
  });
  
  app.on('window-all-closed', () =&gt; {
    if (process.platform !== 'darwin') {
      app.quit();
    }
  });</code></pre>
  </div>
  </div>
  </p>
  <p>And my <code>index.html</code> file:</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!doctype html&gt;
  &lt;html lang="en"&gt;
  &lt;head&gt;
    &lt;meta charset="utf-8"&gt;
    &lt;title&gt;BRISA Carbon&lt;/title&gt;
    &lt;base href="/"&gt;
  
    &lt;meta name="viewport" content="width=device-width, initial-scale=1"&gt;
    &lt;link rel="icon" type="image/x-icon" href="favicon.ico"&gt;
  
    &lt;!--Clarity Design Elements--&gt;
    &lt;link rel="stylesheet" href="../node_modules/clarity-icons/clarity-icons.min.css"&gt;
    &lt;script type="text/javascript" src="../node_modules/@webcomponents/custom-elements/custom-elements.min.js"&gt;&lt;/script&gt;
    &lt;script type="text/javascript" src="../node_modules/clarity-icons/clarity-icons.min.js"&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
    &lt;app-root&gt;&lt;/app-root&gt;
  &lt;/body&gt;
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>
  <h1>My Problem</h1>
  <p>When I run <code>ng serve</code>, the node_modules resources inside the .html file are not being loaded and the Chrome console outputs the following messages</p>
  <p><a href="https://i.stack.imgur.com/Q78b7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Q78b7.png" alt="enter image description here" /></a></p>
  <p>I know that the path to the resources are correct because I'm using WebStorm IDE and I can go to the referenced element through a link like this image below.</p>
  <p><a href="https://i.stack.imgur.com/gOuUE.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gOuUE.png" alt="enter image description here" /></a></p>
  <p>Why my resources are not being loaded when I'm running in Angular live mode?</p>