title: Cannot run production build
body: <p>I am developing API with nestjs and TypeORM connected with PostgreSQL. NestJS is using <code>ormconfig.json</code> file to provide database connection.</p>
  
  <pre><code>{
    "type": "postgres",
    "host": "localhost",
    "port": 5432,
    "username": "xyz",
    "password": "xyz",
    "database": "xyz",
    "entities": ["src/**/**.entity{.ts,.js}"],
    "synchronize": true
  }
  </code></pre>
  
  <p>When in dev mode <code>npm run start:dev</code> everything works OK, API is responding, connected properly with database. But when I try run production build: <code>npm run prestart:prod</code> followed by <code>npm run start:prod</code> something breaks and program cannot connect to the database, that cause error:</p>
  
  <pre class="lang-sh prettyprint-override"><code>[Nest] 12444   - 2019-04-09 22:19   [NestFactory] Starting Nest application...
  [Nest] 12444   - 2019-04-09 22:19   [InstanceLoader] TypeOrmModule dependencies initialized +85ms
  [Nest] 12444   - 2019-04-09 22:19   [InstanceLoader] AppModule dependencies initialized +3ms
  [Nest] 12444   - 2019-04-09 22:19   [TypeOrmModule] Unable to connect to the database. Retrying (1)... +111ms
  C:\_code\sensorhub\packages\api-nestjs\src\installations\models\installation.entity.ts:1
  (function (exports, require, module, __filename, __dirname) { import { Entity, PrimaryGeneratedColumn, Column } from 'typeorm';
                                                                       ^
  
  SyntaxError: Unexpected token {
      at new Script (vm.js:79:7)
      at createScript (vm.js:251:10)
      at Object.runInThisContext (vm.js:303:10)
      at Module._compile (internal/modules/cjs/loader.js:657:28)
      at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
      at Module.load (internal/modules/cjs/loader.js:599:32)
      at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
      at Function.Module._load (internal/modules/cjs/loader.js:530:3)
      at Module.require (internal/modules/cjs/loader.js:637:17)
      at require (internal/modules/cjs/helpers.js:22:18)
  [Nest] 12444   - 2019-04-09 22:19   [TypeOrmModule] Unable to connect to the database. Retrying (2)... +3130ms
  </code></pre>
  
  <p>installation.entity.ts</p>
  
  <pre class="lang-js prettyprint-override"><code>import { Entity, PrimaryGeneratedColumn, Column } from 'typeorm';
  
  @Entity()
  export class InstallationEntity {
    @PrimaryGeneratedColumn()
    id: number;
  
    @Column({ length: 500 })
    name: string;
  
    @Column('text')
    description: string;
  }
  </code></pre>
  
  <p>I think that code itself is correct, but there is something wrong with proper configuration.</p>
  
  <p>nestjs <code>ver.6.0.0</code></p>