Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nuxt Plugins not working after build ( use apexchart )

I use apex chart in nuxt
and apply plugins with my code
this working in dev mode

cross-env NODE_ENV=development HOST=0.0.0.0 PORT=3000 nodemon server/index.js --watch server

but not working in build source

nuxt build && cross-env NODE_ENV=production HOST=0.0.0.0 PORT=80 node server/index.js


Here is my codes

plugins/vue-apexchar.js

import Vue from 'vue'
import VueApexCharts from 'vue-apexcharts'

Vue.component('VueApexCharts', VueApexCharts);


nuxt.config.js

plugins: [
    { src : '~/plugins/vue-apexchart.js', ssr : false },
],
build: {
  vendor : [
     'vue-apexchart'
  ]
}


weekChart.vue

<VueApexCharts max-width="300" type="area" :options="chartOptions" :series="series"></VueApexCharts>

these codes working in dev mode but not working build files
I needs your helps for solve this problomes
Please Help me
Here is my source code > https://github.com/zoz0312/Nuxt_Blog

like image 545
AJu Avatar asked Mar 03 '23 05:03

AJu


1 Answers

<client-only>
    <MY COMPONENT/>
</client-only>

Using 'client-only' tag solved this problem

"This component is used to purposely render a component only on client-side."
my plugins working only client-side so use that tags, I can Solved this problem

like image 122
AJu Avatar answered Mar 20 '23 19:03

AJu