maximegris / angular-electron

Ultra-fast bootstrapping with Angular and Electron :speedboat:
https://www.maximegris.fr/angular-electron/
MIT License
5.67k stars 1.37k forks source link

How to import Apollo angular packages #79

Closed shtanaka closed 6 years ago

shtanaka commented 6 years ago

Hi,

I am trying to import some Apollo packages to angular but it is not working in the build. my dependencies are as following:

"dependencies": {
    "@angular/common": "4.4.3",
    "@angular/compiler": "4.4.3",
    "@angular/core": "4.4.3",
    "@angular/forms": "4.4.3",
    "@angular/http": "4.4.3",
    "@angular/platform-browser": "4.4.3",
    "@angular/platform-browser-dynamic": "4.4.3",
    "@angular/router": "4.4.3",
    "apollo-angular": "0.13.0",
    "apollo-client": "1.9.2",
    "apollo-phoenix-websocket": "^0.6.2",
    "core-js": "2.4.1",
    "enhanced-resolve": "3.3.0",
    "graphql-tag": "^2.0.0",
    "rxjs": "5.4.3",
    "zone.js": "0.8.17"
  },

the comand npm run start:web is running properly but everytime i try to build the app using npm run electron:mac i get the following errors:

node_modules/@types/core-js/index.d.ts(656,11): error TS2428: All declarations of 'WeakMap' must have identical type parameters.
node_modules/@types/graphql/subscription/subscribe.d.ts(17,4): error TS2304: Cannot find name 'AsyncIterator'.
node_modules/@types/graphql/subscription/subscribe.d.ts(29,4): error TS2304: Cannot find name 'AsyncIterable'.
node_modules/@types/isomorphic-fetch/index.d.ts(14,14): error TS2300: Duplicate identifier 'RequestMode'.
node_modules/@types/isomorphic-fetch/index.d.ts(15,14): error TS2300: Duplicate identifier 'RequestCredentials'.
node_modules/@types/isomorphic-fetch/index.d.ts(16,14): error TS2300: Duplicate identifier 'RequestCache'.
node_modules/@types/isomorphic-fetch/index.d.ts(20,14): error TS2300: Duplicate identifier 'ResponseType'.
node_modules/@types/isomorphic-fetch/index.d.ts(23,14): error TS2300: Duplicate identifier 'BodyInit'.
node_modules/@types/isomorphic-fetch/index.d.ts(24,14): error TS2300: Duplicate identifier 'RequestInfo'.
node_modules/@types/isomorphic-fetch/index.d.ts(28,5): error TS2403: Subsequent variable declarations must have the same type.  Variable 'headers' must be of type 'any', but here has type 'string[] | Headers | { [index: string]: string; }'.
node_modules/@types/isomorphic-fetch/index.d.ts(30,5): error TS2403: Subsequent variable declarations must have the same type.  Variable 'mode' must be of type 'RequestMode', but here has type 'string'.
node_modules/@types/isomorphic-fetch/index.d.ts(31,5): error TS2403: Subsequent variable declarations must have the same type.  Variable 'credentials' must be of type 'RequestCredentials', but here has type 'string'.
node_modules/@types/isomorphic-fetch/index.d.ts(32,5): error TS2403: Subsequent variable declarations must have the same type.  Variable 'cache' must be of type 'RequestCache', but here has type 'string'.
node_modules/@types/isomorphic-fetch/index.d.ts(41,15): error TS2300: Duplicate identifier 'Headers'.
node_modules/@types/isomorphic-fetch/index.d.ts(61,5): error TS2687: All declarations of 'bodyUsed' must have identical modifiers.
node_modules/@types/isomorphic-fetch/index.d.ts(81,15): error TS2300: Duplicate identifier 'Request'.
node_modules/@types/isomorphic-fetch/index.d.ts(115,13): error TS2300: Duplicate identifier 'fetch'.
node_modules/@types/lodash/index.d.ts(17095,15): error TS2428: All declarations of 'WeakMap' must have identical type parameters.
node_modules/typescript/lib/lib.d.ts(7960,11): error TS2300: Duplicate identifier 'Headers'.
node_modules/typescript/lib/lib.d.ts(7969,13): error TS2300: Duplicate identifier 'Headers'.
node_modules/typescript/lib/lib.d.ts(13115,11): error TS2300: Duplicate identifier 'Request'.
node_modules/typescript/lib/lib.d.ts(13132,13): error TS2300: Duplicate identifier 'Request'.
node_modules/typescript/lib/lib.d.ts(18751,18): error TS2300: Duplicate identifier 'fetch'.
node_modules/typescript/lib/lib.d.ts(18756,6): error TS2300: Duplicate identifier 'BodyInit'.
node_modules/typescript/lib/lib.d.ts(18787,6): error TS2300: Duplicate identifier 'RequestInfo'.
node_modules/typescript/lib/lib.d.ts(18836,6): error TS2300: Duplicate identifier 'RequestCache'.
node_modules/typescript/lib/lib.d.ts(18837,6): error TS2300: Duplicate identifier 'RequestCredentials'.
node_modules/typescript/lib/lib.d.ts(18839,6): error TS2300: Duplicate identifier 'RequestMode'.
node_modules/typescript/lib/lib.d.ts(18842,6): error TS2300: Duplicate identifier 'ResponseType'.

apparently some duplicate identifiers between the packages that electron doesn't handle, but I couldn't find it yet.

Does anyone has a clue of what is happening ?

maximegris commented 6 years ago

Well I just followed basic setup of Apollo-Angular . (https://www.apollographql.com/docs/angular/basics/setup.html)

I had to edit node_modules/tsconfig to make it works (see https://github.com/apollographql/graphql-subscriptions/issues/83#issuecomment-326675684). It does work with npm run start:web and npm run electron:windows. (no mac here to test npm) I close the issue. It an issue of apollo-angular/typescript.