Library Entry Point
Overview
An entry point is the path used to import a library into your application.
Apollo Orbit provides two entry points into the library:
@apollo-orbit/angular/core
: This is a full-featured Angular implementation of@apollo/client
library.@apollo-orbit/angular
: Provides the full functionality of@apollo-orbit/angular/core
+ all the state management capabilities covered in State section
If, for some reason, you're only interested in the core functionality of Apollo Orbit without the added state management capabilities, you can follow the steps below:
Using @apollo-orbit/angular/core
Update ESLint
Add the following rule to .eslintrc.js to ensure the correct import path is used in your application.
.eslintrc.js
'no-restricted-imports': [
'error',
{
paths: [
{
name: '@apollo/client',
message: 'Please use @apollo/client/core instead.'
},
{
name: '@apollo-orbit/angular',
message: 'Please use @apollo-orbit/angular/core instead.'
}
]
}
]
Update codegen.ts
Add importFromCore
config to codegen.ts file created in the environment setup guide.
codegen.ts
import { CodegenConfig } from '@graphql-codegen/cli';
const config: CodegenConfig = {
schema: [
...
],
config: {
importFromCore: true,
...
},
generates: {
...
}
};
export default config;