title: How to get file hash name in Angular?
body: <p>In <code>Angular 4</code> I've used <code>Webpack</code>'s (or even <code>File-loader</code>'s) require method to get Image hash name:</p>
  
  <pre><code>const versionedName = require('assets/images/icn-copy.svg');
  </code></pre>
  
  <p>It returns something like "<code>assets/images/icn-copy.435435fj5435f345345f435f435f345f.svg</code>" - hashed file name. And I could use it for request to server.
  But after migration to <code>Angular 6</code> require function started returning object with property "<code>default</code>" that contains <strong>not</strong> hashed name.</p>
  
  <p>How can I get hashed name in <code>Angular 6</code> and later?</p>
  
  <p><strong>Update:</strong>
  I've noticed that images after migration are not hashed at all now. It may be the reason. For example </p>
  
  <pre><code>.loader {
      background-image: url('assets/images/spinner.svg');
  ...
  }
  </code></pre>
  
  <p>results in just spinner.svg in the root instead of <code>spinner.214312fe21fe412f4ef.svg</code></p>
  
  <p><strong>Update 2</strong>:
  As the issue is solved now, I would appreciate to hear about better way to bypass caching for images though. <code>require()</code> is definitely <strong>not</strong> the best way. It is not about images from assets. It is about requested ones. For example:</p>
  
  <pre><code>this.http.get('assets/images/spinner.svg') // will be cached
  this.http.get('assets/images/spinner.214312fe21fe412f4ef.svg') // will NOT be cached.
  </code></pre>