I am interested in using the wavesurfer plugin for audio visualization within the Nuxt.js framework.
However, I am unsure of how to properly import and use it. My application is running in universal (SSR) mode.
If I try to import it like this:
import WaveSurfer from 'wavesurfer.js';
I receive an error stating that window is not defined
.
If I create a new plugin in the plugins directory, import it, and add it to the nuxt.config.js file under the plugins section, it does not work and gives me the following error message:
wavesurfer is not defined
.
What would be the correct approach to resolve this issue?