VenoBox icon indicating copy to clipboard operation
VenoBox copied to clipboard

Could not find a declaration file for module venobox

Open hallowichig0 opened this issue 3 years ago • 2 comments
trafficstars

Hi,

I just want to declare this venobox using import like this: import VenoBox from 'venobox';

But it throws warning:

Could not find a declaration file for module 'venobox'. 'website/node_modules/venobox/dist/venobox.min.js' implicitly has an 'any' type. Try npm i --save-dev @types/venobox if it exists or add a new declaration (.d.ts) file containing declare module 'venobox';

hallowichig0 avatar Mar 23 '22 10:03 hallowichig0

Hi, I'm not totally sure, but you could try to import VenoBox from /src/venobox.esm.js.

/dist/venobox.min.js is the built and compressed version, not the module.

nicolafranchini avatar Mar 24 '22 11:03 nicolafranchini

I have the same error. I have tried the method you suggested but it didn't work.

VenoBox from /src/venobox.esm.js Or VenoBox from /venobox/src/venobox.esm.js

reshaelfianur avatar Mar 27 '22 01:03 reshaelfianur

I have the same error. I have tried the method you suggested but it didn't work.

VenoBox from /src/venobox.esm.js Or VenoBox from /venobox/src/venobox.esm.js

Inside my demo is working fine, be sure you have the correct path to the esm.js file, maybe with a starting dot, and that the script type is "module"

<script type="module"> 
    import VenoBox from './js/venobox/src/venobox.esm.js';
    console.log(VenoBox);
    new VenoBox();
</script>

here a working example: https://codepen.io/nicolafranchini/pen/mdgoBmB

nicolafranchini avatar Apr 26 '24 10:04 nicolafranchini