5

I have an Angular 1.5.5 project that uses jspm to fetch and bundle all front-end dependencies - angular, angular-material, angular-adal, ngcomponentrouter etc.

We're resolving all of these dependencies using the npm: endpoint. The issue arises when we install angular-material, as it pulls in 2nd dependency on angular from github:angular/bower-angular (instead of npm:angular).

This can be replicated by running:

jspm install npm:angular
jspm install npm:angular-material

Of which the 2nd command outputs:

     Looking up npm:angular-material
     Updating registry cache...
     Downloading npm:angular-material@1.1.0-rc4-master-06e7e99
     Looking up github:angular/bower-angular
     Looking up github:angular/bower-angular-messages
     Looking up github:systemjs/plugin-css
     Looking up github:angular/bower-angular-animate
     Looking up github:angular/bower-angular-aria
ok   Installed github:angular/bower-angular-messages@^1.5.3 (1.5.5)
ok   Installed github:angular/bower-angular@^1.5.3 (1.5.5)
ok   Installed github:angular/bower-angular-aria@^1.5.3 (1.5.5)
ok   Installed github:angular/bower-angular-animate@^1.5.3 (1.5.5)

Resulting in angular being loaded twice by our UI - once from wwwroot/lib/github/angular and once from wwwroot/lib/npm/angular@1.5.5

My question is this:

Is there any way to force the same angular dependency to be resolved from only one source? How can I ensure that only a single dependency of angular 1.5.5 is loaded?

Squiggle
  • 2,427
  • 1
  • 18
  • 22
  • just install angular-material, angular will be installed automatically as one of its dependencies. – nitin May 23 '16 at 15:12
  • 1
    Two problems with that: firstly I need to be able to reference angular directly, not as a sub-dependency. Secondly, other npm libraries I use depend on npm:angular. Your recommendation makes sense, but would not solve the problem in my case. – Squiggle May 23 '16 at 15:40
  • I have exactly the same problem. Did you solve it? I will try to find a way to override and map bower-angular to angular in systemjs packages configuration. – Emiliano May 04 '17 at 12:52
  • I didn't find a resolution - we switched to other frameworks shortly afterwards. Things have moved quickly in the year since I posted this question! – Squiggle May 07 '17 at 07:35

0 Answers0