Can't Resolve NPM Dependencies in Shared Angular 2 Library -


i trying create angular 2 library services, components, , models want share between 3-4 different interfaces/apps frontends same database.

i using helpful angular 2 generator library here.

my services in library based around apollo client , graphql.

however, when symlink library build import main project, apollo dependencies don't seem resolve.

i following 2 errors app build: can't resolve 'apollo-angular/index' , can't resolve 'graphql-tag/index'. in spite of fact both these libraries installed node_modules in app, however, don't seem transferred gulp build dist directory of library not sure meant be.

i have tried setup peer dependencies in library's package.json follows:

"peerdependencies": {     "@angular/core": "^4.0.0",     "rxjs": "^5.1.0",     "zone.js": "^0.8.4",     "graphql-tag": "^2.4.2",     "apollo-angular": "^0.13.0",     "apollo-client": "~1.9.0-1" } 

in addition, when run npm install check installed, npm warn apollo-angular@0.13.0 requires peer of apollo-client@>=0.8.0 <=0.10.1 || >=1.0.0-rc <2.0.0 none installed. , npm warn apollo-client-rxjs@0.5.2 requires peer of apollo-client@>=0.7.2 <=0.10.1 || >=1.0.0-beta <2.0.0 none installed. though apollo client 1.9.0-1 installed. these warnings both app , library running npm install.

if use apollo client in app directly (not through library) works fine in spite of these warnings.

can point me in right direction resolve these issues?

update:

as requested in comments, can confirm apollo client exists in both app's node_modules folder , library's. version 1.9.0-1 in both cases. apollo client used making graphql queries angular 2 applications.

it might occur because of this issue.

try define paths in ts

"compileroptions" : {    ...    "paths": {     "@angular/*": ["../node_modules/@angular/*"],     "apollo-client": ["../node_modules/apollo-client"],     "apollo-client-rxjs": ["../node_modules/apollo-angular/node_modules/apollo-client-rxjs"]   } } 

Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -