title: Compression webpack plugin
body: <p>I'm trying to figure out how to properly use <em>webpack-html-plugin</em> with the <em>compression plugin</em>, the documentation of latter is a bit scarce.</p>
  
  <p>My webpack configuration declares :</p>
  
  <pre><code>output: {
    filename: 'js/[name]-[hash].js',
  </code></pre>
  
  <p>The compression plugin is run at last</p>
  
  <pre><code>new CompressionPlugin({
      asset: "[path].gz[query]",
      algorithm: "gzip"
  })
  </code></pre>
  
  <p>In the end the scripts are correctly produced and compressed.</p>
  
  <pre><code>js/app-caf3b4b3.js.gz     382 kB          [emitted]  [big] 
  </code></pre>
  
  <p>I can declare the preloading of the gzipped file in the <code>index.html</code> template </p>
  
  <pre><code> &lt;link rel="preload" href="&lt;%= htmlWebpackPlugin.files.chunks[chunk].entry %&gt;.gz" as="script"&gt;
  </code></pre>
  
  <p>But webpack is in charge for the insertion of this line :</p>
  
  <pre><code>&lt;script type="text/javascript" src="/js/app-caf3b4b3.js"&gt;
  </code></pre>
  
  <p>inside of <code>&lt;body&gt;&lt;/body&gt;</code></p>
  
  <p>How can I ask webpack to use the compressed script ?</p>