react-apexcharts icon indicating copy to clipboard operation
react-apexcharts copied to clipboard

NextJs Cannot use 3rd party library using Apexcharts

Open Jaypov opened this issue 4 years ago • 1 comments

I have created a storybook repo in which multiple apps share (nextjs SSR and normal client side rendered react apps).

I have used Apexcharts in my storybook, however when i import my components into a nextJS app i get 'window' not defined.

I have tried creating a hook that mimics "componentDidMount" to force the component to load client side where window is available however this did not work.

I guess i could just add "@next-tools/dynamic" to my storybook and load the component dynamically. However i was hoping to keep the storybook as platform agnostic as possible.

Another solution i thought may be to leave apexcharts out of my transpired package and import it using a good old

can anyone tell me why i am getting this window error even though i am forcing the component to only mount client side / any suggestions to a fix

Jaypov avatar Oct 26 '21 15:10 Jaypov

Is this the same question as https://github.com/apexcharts/react-apexcharts/issues/358 ?

ccssmnn avatar Jan 03 '22 08:01 ccssmnn