title: Ionic 3: Build in “prod” mode: Cannot find module “.”
body: <p>we have a large <code>Ionic</code> app that we’re trying to <code>build</code> in <code>production</code> mode since it’s almost ready. The first issue we found is that we were getting a “<code>JavaScript</code> heap out of memory” error when compiling, but we fixed it by giving more memory to node:</p>
  
  <pre><code>"ionic:build": "node --max-old-space-size=16384 ./node_modules/@ionic/app-scripts/bin/ionic-app-scripts.js build",
  
  npm run ionic:build -- --prod
  </code></pre>
  
  <p>With this command the app successfully builds, but if I open it I get the following error:</p>
  
  <pre><code>Uncaught Error: Cannot find module “.”
  at vendor.js:1
  at vendor.js:1
  at Object. (vendor.js:1)
  at e (vendor.js:1)
  at Object. (main.js:1)
  at e (vendor.js:1)
  at window.webpackJsonp (vendor.js:1)
  at main.js:1
  </code></pre>
  
  <p>I searched a bit and I found that it could be caused by <code>require</code>, but we aren’t using it. Any idea of what could be going on or what we can do to debug the issue? Is there any way to use “–-prod” without minifying the JS?</p>
  
  <p>This is my environment:</p>
  
  <pre><code>cli packages: (/usr/local/lib/node_modules)
  
  @ionic/cli-utils  : 1.19.2
  ionic (Ionic CLI) : 3.20.0
  global packages:
  
  cordova (Cordova CLI) : 6.5.0 
  Gulp CLI              : [09:06:54] CLI version 3.9.1 [09:06:54] Local version 3.9.1
  local packages:
  
  @ionic/app-scripts : 3.1.9
  Cordova Platforms  : android 6.1.2 ios 4.3.1
  Ionic Framework    : ionic-angular 3.9.2
  System:
  
  Android SDK Tools : 25.2.5
  ios-deploy        : 1.9.1 
  ios-sim           : 5.0.8 
  Node              : v8.6.0
  npm               : 5.3.0 
  OS                : macOS High Sierra
  Xcode             : Xcode 9.3.1 Build version 9E501 
  Misc:
  
  backend : legacy
  </code></pre>
  
  <p>Thank you!</p>