Closed patolax closed 1 year ago
You won't need react
itself, but some of our TypeScript declarations reference it - you should be good if you install @types/react
only. That will also not have any impact on your bundle size or bundled runtime code in general!
still getting the same error, I could not use ng add apollo-angular in this project. But I created a fresh angular project and used the command, things seem to work fine.
Why do we get react errors in my existing project
Hey @patolax 👋
You'll need to import from @apollo/client/core
to get this to work correctly. We've had other issues that point this out as well. This is something we are changing in v4 as its fairly confusing for projects that aren't using React, such as yours.
Hope that helps!
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. For general questions, we recommend using StackOverflow or our discord server.
Issue Description
I am getting this error on angular 14. Why would it ask about react in angular project? I also tried installing react but it did not work.
./node_modules/@apollo/client/react/context/ApolloConsumer.js:2:0-31 - Error: Module not found: Error: Can't resolve 'react'
package.json
"dependencies": { "@angular-material-components/datetime-picker": "^8.0.0", "@angular/animations": "^14.2.12", "@angular/cdk": "^14.2.7", "@angular/common": "^14.2.12", "@angular/compiler": "^14.2.12", "@angular/core": "^14.2.12", "@angular/forms": "^14.2.12", "@angular/material": "^14.2.7", "@angular/platform-browser": "^14.2.12", "@angular/platform-browser-dynamic": "^14.2.12", "@angular/platform-server": "^14.2.12", "@angular/router": "^14.2.12", "@angularclass/hmr": "^3.0.0", "@angularclass/hmr-loader": "^3.0.2", "@aspnet/signalr": "^1.0.27", "@asymmetrik/ngx-leaflet": "^14", "@asymmetrik/ngx-leaflet-draw": "^14", "@asymmetrik/ngx-leaflet-markercluster": "^14", "@ngrx/effects": "14", "@ngrx/entity": "14", "@ngrx/router-store": "14", "@ngrx/schematics": "14", "@ngrx/store": "14", "@ngrx/store-devtools": "14", "angular-auth-oidc-client": "13.1.0", "angular-split": "^14.1.0", "chart.js": "^3.9.1", "core-js": "^3.10.0", "file-saver": "^2.0.5", "guid-typescript": "^1.0.9", "hammerjs": "^2.0.8", "jsrsasign": "^10.4.0", "jszip": "^3.10.1", "karma-coverage": "^2.2.0", "leaflet": "^1.5.1", "leaflet-deepzoom": "^2.0.0", "leaflet-draw": "1.0.2", "leaflet-draw-drag": "^0.4.5", "leaflet-minimap": "^3.6.1", "leaflet-mouse-position": "^1.2.0", "leaflet-path-drag": "^1.1.0", "leaflet.markercluster": "^1.4.1", "lodash": "^4.17.21", "material-design-icons": "^3.0.1", "ng2-charts": "^3.1.2", "ngrx-store-freeze": "^0.2.4", "ngrx-store-logger": "^0.2.4", "ngx-color-picker": "^13.0.0", "ngx-odata-v4": "^1.1.1", "ngx-papaparse": "^6.0.2", "normalize.css": "^8.0.1", "roboto-fontface": "^0.10.0", "rxjs": "^7.8.0", "text-mask-core": "^5.1.2", "ts-date": "^3.0.2", "tslib": "^2.0.0", "zone.js": "^0.12.0", "@apollo/client": "3.7.12", "apollo-angular": "4.2.1", "graphql": "16.6.0" },
Link to Reproduction
NA
Reproduction Steps
No response