rxjs – Angular 13 Upgrade: CommonJS or AMD dependencies can cause optimization bailouts
I’m getting a number of such warnings on various files while upgrading project from angular 12 to angular 13 (originally written in Angular 6).
‘..ts’ depends on ‘rxjs/BehaviorSubject’. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: angular.io/guide/build#configuring-commonjs-dependencies
‘..ts’ depends on ‘rxjs/add/observable/throw’. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: angular.io/guide/build#configuring-commonjs-dependencies
‘..ts’ depends on ‘rxjs/add/operator/catch’. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: angular.io/guide/build#configuring-commonjs-dependencies
‘..ts’ depends on ‘rxjs/Observable’. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: angular.io/guide/build#configuring-commonjs-dependencies
‘..ts’ depends on ‘rxjs/operators/map’. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: angular.io/guide/build#configuring-commonjs-dependencies
‘..ts’ depends on ‘rxjs/operators/tap’. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: angular.io/guide/build#configuring-commonjs-dependencies
The link provided says here CommonJS is making your bundles larger, but I’m not clear what change should I make to my code. Please advise!
For example, I have:
import { Observable } from 'rxjs/Observable';
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
import { map } from 'rxjs/operators/map';
import { tap } from 'rxjs/operators/tap';
import { catchError, retry, delay } from 'rxjs/operators';
import 'rxjs/add/operator/catch';
import 'rxjs/add/observable/throw';
In my package.json I have
“rxjs”: “^6.5.3”,
“rxjs-compat”: “^6.6.7”,
and I’m using
“typescript”: “~4.6.2”
Read more here: Source link