Previously I was able to import only used operators with this code:
import 'rxjs/Observable';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/mergeMap';
import 'rxjs/add/operator/catch';
import 'rxjs/add/operator/finally';
import 'rxjs/add/observable/empty';
import 'rxjs/add/observable/throw';
This generates a small bundle (vendor.ts).
How to do this with RxJS without requiring rxjs-compat?
Changing the code above to import 'rxjs';
generates a bigger bundle.
UPDATE:
I followed all the answers you've posted but nothing works well. This is my updated vendor.ts:
import 'rxjs/Observable';
import 'rxjs/Subscription';
import 'rxjs/Subject';
import 'rxjs/observable/throw';
import 'rxjs/operators/map';
import 'rxjs/operators/mergeMap';
import 'rxjs/operators/catchError';
import 'rxjs/operators/finalize';
I also tried using 'rxjs/add/operator/*'.
This is how I'm importing rxjs:
import {Observable} from 'rxjs/Observable';
import {Subscription} from 'rxjs/Subscription';
import {Subject} from 'rxjs/Subject';
import {_throw} from 'rxjs/observable/throw';
import {map} from 'rxjs/operators/map';
import {mergeMap} from 'rxjs/operators/mergeMap';
import {catchError} from 'rxjs/operators/catchError';
import {finalize} from 'rxjs/operators/finalize';
I changed my Webpack 3 configuration according to this document (https://github.com/ReactiveX/rxjs/blob/master/doc/pipeable-operators.md#build-and-treeshaking) and nothing works.
Finally, take a look at the Webpack Bundle Analyzer result:
The bundle includes all operators. I found this related issue: https://github.com/angular/angular-cli/issues/9069