Skip to content

Commit 4648323

Browse files
author
Guillaume Chau
committed
fix: code-split faker
1 parent c69b9e7 commit 4648323

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

src/generate.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import faker from 'faker'
2-
3-
export function generate (count) {
1+
export async function generate (count) {
2+
const faker = (await import(/* webpackChunkName: 'faker' */ 'faker')).default
43
const items = []
54
for (let i = 0; i < count; i++) {
65
// const posts = []

src/store.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ const store = new Vuex.Store({
5454
},
5555
},
5656
actions: {
57-
generateItems ({ commit }, count) {
58-
items = generate(count)
57+
async generateItems ({ commit }, count) {
58+
items = await generate(count)
5959
commit('generatedCount', count)
6060
},
6161

0 commit comments

Comments
 (0)