Skip to content

Commit

Permalink
fix: code-split faker
Browse files Browse the repository at this point in the history
  • Loading branch information
Guillaume Chau committed Mar 27, 2019
1 parent c69b9e7 commit 4648323
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions src/generate.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import faker from 'faker'

export function generate (count) {
export async function generate (count) {
const faker = (await import(/* webpackChunkName: 'faker' */ 'faker')).default
const items = []
for (let i = 0; i < count; i++) {
// const posts = []
Expand Down
4 changes: 2 additions & 2 deletions src/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ const store = new Vuex.Store({
},
},
actions: {
generateItems ({ commit }, count) {
items = generate(count)
async generateItems ({ commit }, count) {
items = await generate(count)
commit('generatedCount', count)
},

Expand Down

0 comments on commit 4648323

Please sign in to comment.