norbjd / imgxplain

Imgxplain, is a tool designed to explain images with an audio description and specific timed actions, such as : drawing a rectangle, a circle, focusing on a particular zone, ...
https://norbjd.github.io/imgxplain/
GNU General Public License v3.0
1 stars 0 forks source link

Import libraries (mainly Wavesurfer) directly from JS #3

Closed norbjd closed 3 years ago

norbjd commented 3 years ago

As of now, external libraries are included in index.html, for example wavesurfer.js :

https://github.com/norbjd/imgxplain/blob/6d0e49d411781303ccd2f3692530c80dfc336d4a/public/index.html#L13

We should be able to import the dependency directly from JS :

import { Wavesurfer } from "wavesurfer.js";

But I don't know how to do this. Now there is a script that add .js to the end of the other imports to be able to import other files :

https://github.com/norbjd/imgxplain/blob/6d0e49d411781303ccd2f3692530c80dfc336d4a/scripts/npm-post-compile.sh#L1-L13

But it does not work with external dependencies. I don't know how to do this.

@kogp112 maybe do you have an idea ?