You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 15, 2023. It is now read-only.
It seems like I need to manually import some of Angular's transitive dependencies.
Expected behavior
If I don't need to import anything from rxjs in my Angular application, the appropriate parts of rxjs needed for Angular to function should still be available to it.
Actual behavior
If I don't import rxjs, or only import specific parts of it like rxjs/Observable, then the parts required by the various Angular modules like @angular/forms don't resolve at run time.
Environment
Brunch: 2.10.3
Node: 6.9.1
NPM: 3.10.8
Operating system: Windows 7
Notes
I ran into this today while doing some code tidying. I noticed that we were importing the whole rxjs library in one file, but were supposed to be only importing the parts we needed like rxjs/Observable or rxjs/add/operator/map. After I removed the reference to the whole package, I started getting run time errors saying that some third party npm module (Angular) couldn't resolve rxjs/add/operator/whatever. If I manually imported that particular operator, it would fail with another package requiring a different operator. I played it safe for now and just re-referenced the whole base package of rxjs.
The issue here is that these Angular (and other) packages are actually UMD bundles and I suspect deppack isn't finding their dependencies correctly. Another thing that I noticed is that the package.json file for one of the offending packages (@angular/forms) doesn't list rxjs as any kind of dependency. I'm not sure it matters. However, the UMD bundle for it includes a shared Angular EventEmitter which does need rxjs. The UMD header defines this dependency however:
Description
It seems like I need to manually import some of Angular's transitive dependencies.
Expected behavior
If I don't need to import anything from
rxjs
in my Angular application, the appropriate parts ofrxjs
needed for Angular to function should still be available to it.Actual behavior
If I don't import
rxjs
, or only import specific parts of it likerxjs/Observable
, then the parts required by the various Angular modules like@angular/forms
don't resolve at run time.Environment
Notes
I ran into this today while doing some code tidying. I noticed that we were importing the whole
rxjs
library in one file, but were supposed to be only importing the parts we needed likerxjs/Observable
orrxjs/add/operator/map
. After I removed the reference to the whole package, I started getting run time errors saying that some third party npm module (Angular) couldn't resolverxjs/add/operator/whatever
. If I manually imported that particular operator, it would fail with another package requiring a different operator. I played it safe for now and just re-referenced the whole base package ofrxjs
.The issue here is that these Angular (and other) packages are actually UMD bundles and I suspect
deppack
isn't finding their dependencies correctly. Another thing that I noticed is that thepackage.json
file for one of the offending packages (@angular/forms
) doesn't listrxjs
as any kind of dependency. I'm not sure it matters. However, the UMD bundle for it includes a shared AngularEventEmitter
which does needrxjs
. The UMD header defines this dependency however:The text was updated successfully, but these errors were encountered: