Skip to content

Commit a2ba14c

Browse files
committed
Use dynamic import to support SSR
1 parent 5632c70 commit a2ba14c

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

index.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import { render } from 'github-buttons'
2-
31
export default {
42
name: 'github-button',
53
props: ['href', 'ariaLabel', 'title', 'dataIcon', 'dataSize', 'dataShowCount', 'dataText'],
@@ -33,11 +31,13 @@ export default {
3331
},
3432
methods: {
3533
paint: function () {
36-
var _ = this.$el.appendChild(document.createElement('span'))
37-
render(_.appendChild(this.$refs._), function (el) {
38-
try {
39-
_.parentNode.replaceChild(el, _)
40-
} catch (_) {}
34+
const _ = this.$el.appendChild(document.createElement('span'))
35+
import(/* webpackMode: "eager" */ 'github-buttons').then(({ render }) => {
36+
render(_.appendChild(this.$refs._), function (el) {
37+
try {
38+
_.parentNode.replaceChild(el, _)
39+
} catch (_) {}
40+
})
4141
})
4242
},
4343
reset: function () {

0 commit comments

Comments
 (0)