Skip to content

Instantly share code, notes, and snippets.

@mhgbrown
Last active July 6, 2019 11:13
Show Gist options
  • Save mhgbrown/eb3604664ed8bff5023e1b99885a4052 to your computer and use it in GitHub Desktop.
Save mhgbrown/eb3604664ed8bff5023e1b99885a4052 to your computer and use it in GitHub Desktop.
Vue, Server Side Rendering, and Handling Dependencies that Require a Browser Environment
Vue.component('apexchart', () => {
// NB: tell webpack to include the dynamic import within
// the main bundle instead of splitting into other bundles.
// https://webpack.js.org/api/module-methods/#import-
return import(
/* webpackMode: "eager" */
'vue-apexcharts'
)
})
<template>
<apexchart .../>
</template>
<template>
<apexchart v-if="mounted" .../>
</template>
<script>
export default {
data () {
return {
mounted: false
}
},
mounted () {
this.mounted = true
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment