title: Offline production build in Angular 9
body: <p>In angular 6, When I executed <em>ng build --prod</em> I got a bunch of files in my dist project folder and index.html that had  </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;html lang="en"&gt;
  &lt;head&gt;
    &lt;meta charset="utf-8"&gt;
    &lt;title&gt;My project&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;link rel="stylesheet" href="styles.5510f6725adb16e901a5.css"&gt;&lt;/head&gt;
  &lt;body&gt;
    &lt;app-root&gt;&lt;/app-root&gt;
  &lt;script type="text/javascript" src="runtime.a66f828dca56eeb90e02.js"&gt;&lt;/script&gt;&lt;script type="text/javascript" src="polyfills.a19b2f1d90e9baecaab8.js"&gt;&lt;/script&gt;&lt;script type="text/javascript" src="main.07ef95a019972121cea2.js"&gt;&lt;/script&gt;&lt;/body&gt;
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>So I opened index.html and my app worked offline just fine.
  But I now updated to angular 9 and after <em>ng build --prod</em> I got this index.html</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;html lang="en"&gt;
  &lt;head&gt;
    &lt;meta charset="utf-8"&gt;
    &lt;title&gt;My project&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;link rel="stylesheet" href="styles.387b68bbf04bb28b1761.css"&gt;&lt;/head&gt;
  &lt;body&gt;
    &lt;app-root&gt;&lt;/app-root&gt;
  &lt;script src="runtime-es2015.0811dcefd377500b5b1a.js" type="module"&gt;&lt;/script&gt;&lt;script src="runtime-es5.0811dcefd377500b5b1a.js" nomodule defer&gt;&lt;/script&gt;&lt;script src="polyfills-es5.61df131d802a89ddffe2.js" nomodule defer&gt;&lt;/script&gt;&lt;script src="polyfills-es2015.77d2d1471503030c423e.js" type="module"&gt;&lt;/script&gt;&lt;script src="main-es2015.e2388ceeb931e40e846b.js" type="module"&gt;&lt;/script&gt;&lt;script src="main-es5.e2388ceeb931e40e846b.js" nomodule defer&gt;&lt;/script&gt;&lt;/body&gt;
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>script tags have now this type="module" and when I'm trying to open index.html the browser throws an error </p>
  
  <pre><code>Access to script at 'file:[path_to_my_app]/runtime-es2015.0811dcefd377500b5b1a.js' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.
  runtime-es2015.0811dcefd377500b5b1a.js:1 Failed to load resource: net::ERR_FAILED
  index.html:1 Access to script at 'file:[path_to_my_app]/polyfills-es2015.77d2d1471503030c423e.js' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.
  polyfills-es2015.77d2d1471503030c423e.js:1 Failed to load resource: net::ERR_FAILED
  index.html:1 Access to script at 'file:[path_to_my_app]/main-es2015.e2388ceeb931e40e846b.js' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.
  </code></pre>
  
  <p>When I change type="module" to type="text/javascript" my app kinda works(it works in chrome but firefox throws <code>Error: "Zone.js has detected that ZoneAwarePromise `(window|global).Promise` has been overwritten.
  Most likely cause is that a Promise polyfill has been loaded after Zone.js (Polyfilling Promise api is not necessary when zone.js is loaded. If you must load one, do so before loading zone.js.)"</code>)</p>
  
  <p>How to make angular 9 project to properly build for offline usage? Also, another related to this question: What should I do so that after I run <em>ng build --prod</em> angular doesn't dump every file in the main folder of the project but only index.html and puts the rest of the files into some other folder in this directory(for example "data"), so that the main folder would look user-friendly.</p>