Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions build/rollup.config.base.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ export default {
VERSION: JSON.stringify(config.version),
}),
],
external: ['apollo-client', 'apollo-link', 'graphql-tag'],
}
17 changes: 17 additions & 0 deletions docs/guide/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,23 @@ new Vue({

You are now ready to use Apollo in your components!


### 4. (OPTIONAL) Install Apollo Components

These components were externalized to allow opting in for them to reduce bundle size. To Install

```js
import Vue from 'vue';
import useApolloComponents from 'node_modules/vue-apollo/components/useApolloComponents'

Vue.install(useApolloComponents)
```

This will provide
- ApolloQuery
- ApolloMutation
- ApolloSubscribeToMore

## IDE integration

### Visual Studio Code
Expand Down
17 changes: 17 additions & 0 deletions src/components/useApolloComponents.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import CApolloQuery from './components/ApolloQuery'
import CApolloSubscribeToMore from './components/ApolloSubscribeToMore'
import CApolloMutation from './components/ApolloMutation'

// Components
export const ApolloQuery = CApolloQuery
export const ApolloSubscribeToMore = CApolloSubscribeToMore
export const ApolloMutation = CApolloMutation

export function install (vue) {
vue.component('apollo-query', CApolloQuery)
vue.component('ApolloQuery', CApolloQuery)
vue.component('apollo-subscribe-to-more', CApolloSubscribeToMore)
vue.component('ApolloSubscribeToMore', CApolloSubscribeToMore)
vue.component('apollo-mutation', CApolloMutation)
vue.component('ApolloMutation', CApolloMutation)
}
18 changes: 0 additions & 18 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import { DollarApollo } from './dollar-apollo'
import { ApolloProvider as plugin } from './apollo-provider'

import CApolloQuery from './components/ApolloQuery'
import CApolloSubscribeToMore from './components/ApolloSubscribeToMore'
import CApolloMutation from './components/ApolloMutation'

import { installMixin } from './mixin'
import { Globals, omit } from '../lib/utils'

Expand Down Expand Up @@ -48,15 +44,6 @@ export function install (Vue, options) {
})

installMixin(Vue, vueVersion)

if (vueVersion === '2') {
Vue.component('apollo-query', CApolloQuery)
Vue.component('ApolloQuery', CApolloQuery)
Vue.component('apollo-subscribe-to-more', CApolloSubscribeToMore)
Vue.component('ApolloSubscribeToMore', CApolloSubscribeToMore)
Vue.component('apollo-mutation', CApolloMutation)
Vue.component('ApolloMutation', CApolloMutation)
}
}

plugin.install = install
Expand All @@ -67,11 +54,6 @@ plugin.version = VERSION
// Apollo provider
export const ApolloProvider = plugin

// Components
export const ApolloQuery = CApolloQuery
export const ApolloSubscribeToMore = CApolloSubscribeToMore
export const ApolloMutation = CApolloMutation

// Auto-install
let GlobalVue = null
if (typeof window !== 'undefined') {
Expand Down