How to import module in JS using Import?

282 views Asked by At

I am trying to import a library in JS but it won't work.

I am getting this error message : Uncaught TypeError: Failed to resolve module specifier "html-to-image". Relative references must start with either "/", "./", or "../".

Here is my code in my js file:

import * as htmlToImage from "html-to-image";
import { toPng, toJpeg, toBlob, toPixelData, toSvg } from "html-to-image";

and here is ho i import my js file in html :

        <script type="module" src="./packOpener.js"></script>

I also installed esbuild (npm install esbuild ) since it could apparently help but whithout success...

Any idea ? :)

I am quite new and i have been block all day on this problem.

0

There are 0 answers