apollographql / apollo-client

:rocket:  A fully-featured, production ready caching GraphQL client for every UI framework and GraphQL server.
https://apollographql.com/client
MIT License
19.33k stars 2.65k forks source link

Observable.js depends on 'zen- observable'. CommonJS or AMD dependencies can cause optimization bailo uts. #7610

Closed rajinder-yadav closed 3 years ago

rajinder-yadav commented 3 years ago

Using Apollo Angular getting this warning.

Warning: /home/yadav/home/yadav/projects/websites/devmentor/node_modul
es/@apollo/client/utilities/observables/Observable.js depends on 'zen-
observable'. CommonJS or AMD dependencies can cause optimization bailo
uts.

My app is making use of async pipe to make a graphql query as shown in this write up:

https://apollo-angular.com/docs/data/queries#using-with-asyncpipe

package.json

{
  "name": "devmentor",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e",
    "db": "json-graphql-server db.js"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "~11.0.9",
    "@angular/common": "~11.0.9",
    "@angular/compiler": "~11.0.9",
    "@angular/core": "~11.0.9",
    "@angular/forms": "~11.0.9",
    "@angular/platform-browser": "~11.0.9",
    "@angular/platform-browser-dynamic": "~11.0.9",
    "@angular/router": "~11.0.9",
    "apollo-angular": "^2.2.0",
    "rxjs": "~6.6.0",
    "tslib": "^2.0.0",
    "zone.js": "~0.10.2",
    "@apollo/client": "^3.0.0",
    "graphql": "^15.0.0"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.1100.7",
    "@angular/cli": "~11.0.7",
    "@angular/compiler-cli": "~11.0.9",
    "@types/jasmine": "~3.6.0",
    "@types/node": "^12.11.1",
    "codelyzer": "^6.0.0",
    "jasmine-core": "~3.6.0",
    "jasmine-spec-reporter": "~5.0.0",
    "json-graphql-server": "^2.2.0",
    "karma": "~5.1.0",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage": "~2.0.3",
    "karma-jasmine": "~4.0.0",
    "karma-jasmine-html-reporter": "^1.5.0",
    "protractor": "~7.0.0",
    "ts-node": "~8.3.0",
    "tslint": "~6.1.0",
    "typescript": "~4.0.2"
  }
}
fkm commented 3 years ago

Seems to be related to #5961.

hwillson commented 3 years ago

Let us know if this is still a concern with @apollo/client@latest - thanks!

hiepxanh commented 3 years ago

Warning: G:\small-cosmos\awread\node_modules\.pnpm\@apollo+client@3.3.19_graphql@15.5.0\node_modules\@apollo\client\utilities\observables\Observable.js depends on 'zen-observable'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

I still have the same issue with 3.3.19 version

benjamn commented 3 years ago

@hiepxanh AC3.4 is switching to zen-observable-ts, if you want to give @apollo/client@3.4.0-rc.4 a try?