title: ERROR in ./node_modules/rxjs/_esm5/operators/index.js Angular 6 ng build --prod of / Resolve
body: <p>My application works well in local but when I want to go to production with <code>ng build --prod</code> I get the following error:</p>
  
  <p>Any idea what may be happening?</p>
  
  <blockquote>
    <p>ERROR in ./node_modules/rxjs/_esm5/operators/index.js
    Module not found: Error: Can't resolve '../internal/operators/endWith' in /Users/.../node_modules/rxjs/_esm5/operators'</p>
  </blockquote>
  
  <p><strong>package.json</strong></p>
  
  <pre><code>{
  "name": "myApp",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "6.0.5",
    "@angular/cdk": "^6.3.3",
    "@angular/common": "^6.0.0",
    "@angular/compiler": "^6.0.0",
    "@angular/core": "^6.0.0",
    "@angular/forms": "^6.0.0",
    "@angular/http": "^6.0.0",
    "@angular/material": "^6.3.3",
    "@angular/platform-browser": "^6.0.0",
    "@angular/platform-browser-dynamic": "^6.0.0",
    "@angular/router": "^6.0.0",
    "angularfire2": "^5.0.0-rc.10",
    "bootstrap": "^4.1.1",
    "core-js": "^2.5.4",
    "firebase": "^5.0.4",
    "jquery": "^3.3.1",
    "popper.js": "^1.14.3",
    "rxjs": "^6.0.0",
    "rxjs-compat": "^6.2.2",
    "zone.js": "^0.8.26"
  },
  "devDependencies": {
    "@angular/compiler-cli": "^6.0.0",
    "@angular-devkit/build-angular": "~0.6.0",
    "typescript": "~2.7.2",
    "@angular/cli": "~6.0.0",
    "@angular/language-service": "^6.0.0",
    "@types/jasmine": "~2.8.6",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "~8.9.4",
    "codelyzer": "~4.2.1",
    "jasmine-core": "~2.99.1",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~1.7.1",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~1.4.2",
    "karma-jasmine": "~1.1.1",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.3.0",
    "ts-node": "~5.0.1",
    "tslint": "~5.9.1"
  }
  }
  </code></pre>
  
  <p>These are the places where I am using RXJS</p>
  
  <p><strong>productos.service.ts</strong></p>
  
  <pre><code>import { of } from 'rxjs';
  ...
  getProductos() {
    return of(this.productos);
  }
  
  getProducto&lt;Producto&gt;(id) {
    return of(this.productos.find(p =&gt; p.id === id));
  }
  </code></pre>
  
  <p>producto.resolver.service.ts</p>
  
  <pre><code>import { Injectable } from '@angular/core';
  import { Router, Resolve, RouterStateSnapshot,
    ActivatedRouteSnapshot } from '@angular/router';
  import { Observable } from 'rxjs';
  import { map, take } from 'rxjs/operators';
  import { Producto, ProductosService } from './productos.service';
  
  @Injectable({
    providedIn: 'root'
  })
  export class ProductoResolver implements Resolve&lt;Producto&gt; {
  
  constructor(private ps: ProductosService, private router: Router) { }
  
  resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): 
  Observable&lt;Producto&gt; {
  let id = route.paramMap.get('id');
  
  return this.ps.getProducto(id).pipe(
    take(1),
    map(producto =&gt; {
      if (producto) {
        return producto;
      } else { // id not found
        console.error('id not found');
        this.router.navigate(['/productos']);
        return null;
      }
    })
  );
  }
  }
  </code></pre>