joeattardi / picmo

JavaScript emoji picker. Any app, any framework.
https://picmojs.com
MIT License
1.19k stars 117 forks source link

Issues on creating the picker with minified js file #252

Closed HDianaz closed 1 year ago

HDianaz commented 1 year ago

I tried to import into my ts file the library with the CDN like this: import { createPicker } from 'https://unpkg.com/picmo@latest/dist/index.js';

And it gives me the following error: Cannot find module 'https://unpkg.com/picmo@latest/dist/index.js' or its corresponding type declarations

Can anyone help me on that? Thanks in advance!

joeattardi commented 1 year ago

You can’t import a module from a URL with typescript.

Browsers support ES Modules where you can do such imports.

However TypeScript has a build/compile step and it doesn’t know how to resolve an import like this.

For a TS project you will need to npm install picmo and then just import from ‘picmo’.

HDianaz commented 1 year ago

Thank you so much!