You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When testing out the first beta release, I tried to run @apollo/client in a CLI environment and it blows up trying to instantiate InMemoryCache. When logging the import, it appears everything from the cache module is set as undefined. Through trial and error, I have narrowed it down to #10509 which introduced the new custom document transform feature.
Re-reviewing that PR, I noted that InMemoryCacheimports the DocumentTransform from core, yet core exports modules from cache resulting in a circular dependency. While some bundlers seem to be able to resolve circular dependencies, running this in the CLI environment fails entirely.
Since DocumentTransform is used both by core and by the cache, we should move that module to a neutral location to avoid the circular dependency.
TypeError: core_1.InMemoryCache is not a constructor
at generatePersistedQueryManifest (/node_modules/@apollo/generate-persisted-query-manifest/dist/index.js:66:16)
The text was updated successfully, but these errors were encountered:
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
When testing out the first beta release, I tried to run
@apollo/client
in a CLI environment and it blows up trying to instantiateInMemoryCache
. When logging the import, it appears everything from thecache
module is set asundefined
. Through trial and error, I have narrowed it down to #10509 which introduced the new custom document transform feature.Re-reviewing that PR, I noted that
InMemoryCache
imports theDocumentTransform
fromcore
, yet core exports modules fromcache
resulting in a circular dependency. While some bundlers seem to be able to resolve circular dependencies, running this in the CLI environment fails entirely.Since
DocumentTransform
is used both by core and by the cache, we should move that module to a neutral location to avoid the circular dependency.Link to Reproduction
apollographql/apollo-utils#287
Reproduction Steps
Use the new
generate-persisted-query-manifest
tool and notice that it blows up with the error:The text was updated successfully, but these errors were encountered: