I am trying to use the npm react-wavesurfer
package, but get the error
this._wavesurfer.init is not a function
This seems to be because wavesurfer is not set up properly. The "Prereqs and common pitfalls" page on the github states that "WaveSurfer needs to be a globall accessible variable."
// provide WaveSurfer as a globally accessible variable
plugins: [
new webpack.ProvidePlugin({
WaveSurfer: 'wavesurfer.js'
})
],
// Alias `wavesurfer` to the correct wavesurfer package.
// (wavesurfer.js has some non-standard naming convention)
resolve: {
alias: {
wavesurfer: require.resolve('wavesurfer.js')
}
},
My react project was created with create-react-app
so I don't have a webpack config file. How can I include these wavesurfer plugins?
Note: This question asks the same thing but the only answer is to use the non-react, wavesurfer.js
package directly. I would prefer to use react-wavesurfer
.
` of you `index.html`, so they're all loaded before you actual app loads and thus available globally
– Jayce444 Dec 05 '19 at 01:31