Module not found: Error: Can't resolve '@apollo/client/core'

46 Views Asked by At

I am using the apollo-angular library in my angular 15 project. It works very well on my local, but when I push to my CI it fails with the below error:

Module not found: Error: Can't resolve '@apollo/client/core' in '/home/runner/work/my-frontend/my-frontend/node_modules/apollo-angular/fesm2022'
Did you mean 'index.js'?
BREAKING CHANGE: The request '@apollo/client/core' failed to resolve only because it was resolved as fully specified
(probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.
resolve '@apollo/client/core' in '/home/runner/work/my-frontend/my-frontend/node_modules/apollo-angular/fesm2022' ```
1

There are 1 best solutions below

3
phry On

In some very specific bundling environments, you might need to specify @apollo/client/core/index.js instead of @apollo/client/core.

As it seems that this is a change that needs to be done in apollo-angular, maybe leave a comment over in https://github.com/kamilkisiela/apollo-angular/issues/2172 ?