I'm using wavesurfer.js with React and Typescript. To get the typings I'm also using the corresponding @types/wavesurfer.js. Now I want to use the cursor plugin. When I'm importing the actual CursorPlugin this way
import CursorPlugin from 'wavesurfer.js/src/plugin/cursor.js';
I get all the type hints etc. but the compiler says:
ERROR in ./path/to/my/component/index.tsx 9:0-62
Module not found: Error: Can't resolve 'wavesurfer.js/src/plugin/cursor.js' in 'path/to/my/component'
Here is the Codesandbox demonstrating this behavior.
I already found a workaround on the interwebs:
import CursorPlugin from 'wavesurfer.js/dist/plugin/wavesurfer.cursor.min.js';
and it works although I don't get type hints this way. But it just doesn't seem to be the "right" way to do it, so I was wandering if anyone else has found any better solution yet?