Skip to content

Commit

Permalink
missing documentation for building with vuex (#2319)
Browse files Browse the repository at this point in the history
I really needed this tip and luckily got it from this awesome community in a github issue.
This definitely needs to be in the docs aswell:
#2304 (comment)
  • Loading branch information
katerlouis authored and pksunkara committed Oct 11, 2019
1 parent 3aa513a commit c760910
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions docs/guide/build-targets.md
Expand Up @@ -142,3 +142,22 @@ Now on the page, the user only needs to include Vue and the entry file:
<!-- foo-one's implementation chunk is auto fetched when it's used -->
<foo-one></foo-one>
```


## Using vuex in builds

When building a [Webcomponent](#web-component) or [Library](#library), the entry point is not `main.js`, but an `entry-wc.js` file, generated here: [https://github.com/vuejs/vue-cli/blob/dev/packages/%40vue/cli-service/lib/commands/build/resolveWcEntry.js](https://github.com/vuejs/vue-cli/blob/dev/packages/%40vue/cli-service/lib/commands/build/resolveWcEntry.js)

So to use vuex in web component target, you need to initialize the store in `App.vue`:

``` js
import store from './store'

// ...

export default {
store,
name: 'App',
// ...
}
```

0 comments on commit c760910

Please sign in to comment.