title: Not able to create an optimized build for my React app in the build folder
body: <p>I have developed a web app using MERN stack. I am in the process of deploying it to production. However, I am not able to create an optimized build of the React app in the build folder. &quot;npm run build&quot; command creates the build folder; however, when I check the index.html file (inside the 'build' folder), I see the following error:</p>
  <p><strong>client/build/index.html</strong></p>
  <pre><code>Html Webpack Plugin:
  &lt;pre&gt;
    Error: html-webpack-plugin could not minify the generated output.
    In production mode the html minifcation is enabled by default.
    If you are not generating a valid html output please disable it manually.
    You can do so by adding the following setting to your HtmlWebpackPlugin config:
    |
    |    minify: false
    |
    See https://github.com/jantimon/html-webpack-plugin#options for details.
    For parser dedicated bugs please create an issue here:
    https://danielruf.github.io/html-minifier-terser/
    Parse Error: &lt;link href=&quot;https://fonts.googleapis.com/css2?family=Roboto+Mono:wght@100;200;300;400;500;600;700&amp;display=swap&quot; re&lt;link rel=&quot;stylesheet&quot; href=&quot;  https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.2/css/all.min.css&quot; integrity=&quot;sha512-HK5fgLBL+xu6dm/Ii3z4xhlSUyZgTT9tuc/hSrtw6uzJOvgRr2a9jyxxT1ely+  B+xFAmJKVSTbpM/CuL7qxO8w==&quot; crossorigin=&quot;anonymous&quot; /&gt;
        &lt;!--
          manifest.json provides metadata used when your web app is installed on a
          user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
        --&gt;
        &lt;link rel=&quot;manifest&quot; href=&quot;/manifest.json&quot; /&gt;
        &lt;!--
          Notice the use of  in the tags above.
          It will be replaced with the URL of the `public` folder during the build.
          Only files inside the `public` folder can be referenced from the HTML.
          Unlike &quot;/favicon.ico&quot; or &quot;favicon.ico&quot;, &quot;/favicon.ico&quot; will
          work correctly both with client-side routing and a non-root public URL.
          Learn how to configure a non-root public URL by running `npm run build`.
        --&gt;
        &lt;title&gt;React App&lt;/title&gt;
      &lt;link href=&quot;/static/css/2.ef9168ec.chunk.css&quot; rel=&quot;stylesheet&quot;&gt;&lt;link href=&quot;/static/css/main.fd364b26.chunk.css&quot; rel=&quot;stylesheet&quot;&gt;&lt;/head&gt;
      &lt;body&gt;
        &lt;noscript&gt;You need to enable JavaScript to run this app.&lt;/noscript&gt;
        &lt;div id=&quot;root&quot;&gt;&lt;/div&gt;
        &lt;!--
          This HTML file is a template.
          If you open it directly in the browser, you will see an empty page.
          You can add webfonts, meta tags, or analytics to this file.
          The build step will place the bundled scripts into the &lt;body&gt; tag.
          To begin the development, run `npm start` or `yarn start`.
          To create a production bundle, use `npm run build` or `yarn build`.
        --&gt;
        &lt;script src=&quot;https://code.jquery.com/jquery-3.3.1.slim.min.js&quot; integrity=&quot;sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo&quot; cross  origin=&quot;anonymous&quot;&gt;&lt;/script&gt;
        &lt;script src=&quot;https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js&quot; integrity=&quot;sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZw  rnQq4sF86dIHNDz0W1&quot; crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;
        &lt;script src=&quot;https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js&quot; integrity=&quot;sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFD  sf4x0xIM+B07jRM&quot; crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;
      &lt;script&gt;!function(e){function t(t){for(var n,l,i=t[0],f=t[1],a=t[2],p=0,s=[];p&lt;i.length;p++)l=i[p],Object.prototype.hasOwnProperty.call(o,l)&amp;&amp;o[l]&amp;&amp;s.push  (o[l][0]),o[l]=0;for(n in f)Object.prototype.hasOwnProperty.call(f,n)&amp;&amp;(e[n]=f[n]);for(c&amp;&amp;c(t);s.length;)s.shift()();return u.push.apply(u,a||[]),r()}functi  on r(){for(var e,t=0;t&lt;u.length;t++){for(var r=u[t],n=!0,i=1;i&lt;r.length;i++){var f=r[i];0!==o[f]&amp;&amp;(n=!1)}n&amp;&amp;(u.splice(t--,1),e=l(l.s=r[0]))}return e}var n={  },o={1:0},u=[];function l(t){if(n[t])return n[t].exports;var r=n[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,l),r.l=!0,r.exports}l.m=e,l  .c=n,l.d=function(e,t,r){l.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},l.r=function(e){&quot;undefined&quot;!==typeof Symbol&amp;&amp;Symbol.toStringTag&amp;&amp;Object  .defineProperty(e,Symbol.toStringTag,{value:&quot;Module&quot;}),Object.defineProperty(e,&quot;__esModule&quot;,{value:!0})},l.t=function(e,t){if(1&amp;t&amp;&amp;(e=l(e)),8&amp;t)return e;if(  4&amp;t&amp;&amp;&quot;object&quot;===typeof e&amp;&amp;e&amp;&amp;e.__esModule)return e;var r=Object.create(null);if(l.r(r),Object.defineProperty(r,&quot;default&quot;,{enumerable:!0,value:e}),2&amp;t&amp;&amp;&quot;stri  ng&quot;!=typeof e)for(var n in e)l.d(r,n,function(t){return e[t]}.bind(null,n));return r},l.n=function(e){var t=e&amp;&amp;e.__esModule?function(){return e.default}:fun  ction(){return e};return l.d(t,&quot;a&quot;,t),t},l.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},l.p=&quot;/&quot;;var i=this.webpackJsonpclient=this.webp  ackJsonpclient||[],f=i.push.bind(i);i.push=t,i=i.slice();for(var a=0;a&lt;i.length;a++)t(i[a]);var c=f;r()}([]);
    //# sourceMappingURL=runtime-main.03887cff.js.map&lt;/script&gt;&lt;script src=&quot;/static/js/2.f2aadee4.chunk.js&quot;&gt;&lt;/script&gt;&lt;script src=&quot;/static/js/main.7226ac02.chunk.  js&quot;&gt;&lt;/script&gt;&lt;/body&gt;
    &lt;/html&gt;
    
    - htmlparser.js:244 new HTMLParser
      [client]/[html-minifier-terser]/src/htmlparser.js:244:13
    
    - htmlminifier.js:993 minify
      [client]/[html-minifier-terser]/src/htmlminifier.js:993:3
    
    - htmlminifier.js:1354 Object.exports.minify
      [client]/[html-minifier-terser]/src/htmlminifier.js:1354:16
    
    - index.js:1013 HtmlWebpackPlugin.minifyHtml
      [client]/[html-webpack-plugin]/index.js:1013:46
    
    - index.js:429 HtmlWebpackPlugin.postProcessHtml
      [client]/[html-webpack-plugin]/index.js:429:40
    
    - index.js:254 
      [client]/[html-webpack-plugin]/index.js:254:25
    
    - task_queues.js:93 processTicksAndRejections
      internal/process/task_queues.js:93:5
    
  &lt;/pre&gt;
  
  </code></pre>
  <p>I get similar errors in my console as well.</p>
  <p><a href="https://i.stack.imgur.com/d6SmQ.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/d6SmQ.jpg" alt="enter image description here" /></a></p>
  <p><strong>How can I fix these errors?</strong></p>
  <p>(I am on windows.)</p>
  <p>index.html</p>
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html lang=&quot;en&quot;&gt;
    &lt;head&gt;
      &lt;meta charset=&quot;utf-8&quot; /&gt;
      &lt;link rel=&quot;icon&quot; href=&quot;%PUBLIC_URL%/favicon.ico&quot; /&gt;
      &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1&quot; /&gt;
      &lt;meta name=&quot;theme-color&quot; content=&quot;#000000&quot; /&gt;
      &lt;meta
        name=&quot;description&quot;
        content=&quot;Web site created using create-react-app&quot;
      /&gt;
      &lt;link rel=&quot;apple-touch-icon&quot; href=&quot;%PUBLIC_URL%/logo192.png&quot; /&gt;
      &lt;link href=&quot;https://fonts.googleapis.com/css2?family=Roboto+Mono:wght@100;200;300;400;500;600;700&amp;family=Roboto:wght@100;300;400;500;700;900&amp;display=swap&quot; rel=&quot;stylesheet&quot;&gt;
      &lt;link href=&quot;https://fonts.googleapis.com/css2?family=Roboto+Mono:wght@100;200;300;400;500;600;700&amp;display=swap&quot; re&lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.2/css/all.min.css&quot; integrity=&quot;sha512-HK5fgLBL+xu6dm/Ii3z4xhlSUyZgTT9tuc/hSrtw6uzJOvgRr2a9jyxxT1ely+B+xFAmJKVSTbpM/CuL7qxO8w==&quot; crossorigin=&quot;anonymous&quot; /&gt;
      &lt;link rel=&quot;manifest&quot; href=&quot;%PUBLIC_URL%/manifest.json&quot; /&gt;
      &lt;title&gt;React App&lt;/title&gt;
    &lt;/head&gt;
    &lt;body&gt;
      &lt;noscript&gt;You need to enable JavaScript to run this app.&lt;/noscript&gt;
      &lt;div id=&quot;root&quot;&gt;&lt;/div&gt;
      &lt;script src=&quot;https://code.jquery.com/jquery-3.3.1.slim.min.js&quot; integrity=&quot;sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo&quot; crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;
      &lt;script src=&quot;https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js&quot; integrity=&quot;sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1&quot; crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;
      &lt;script src=&quot;https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js&quot; integrity=&quot;sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM&quot; crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>