How to import an external package

Hello,

I'm using ChartJS package because I need to use a combined chart (not available in wappler).

In order to set the colors, I need to import the patternomaly package on my JS file, when I try to import it like this:

import pattern from 'patternomaly';

I get this error on wappler's code editor:

Any ideas?

If the package is supported for use in a browser there is usually a cdn or local js file that is used in a script tag. You can’t directly import the same way you would do on a node server, although you can make it happen by creating a module if you have some solid js knowledge.

1 Like

Hi. From what I know, the import command is not meant to be used client side.
You need to find a script URL and add it as any other script tag on the page. Then, you will need to initialize the library and have it available to be used.

I have not used this library that you mention, so can’t suggest exact code.

1 Like

Thanks to both for your reply. I’m going to search a little bit more.

I couldn’t find any script URL before creating this posts, I’m going to search a little bit more.

Thanks! Carlos