You can now use npm modules in your Code!

We’ve added a way to incorporate external modules into your code!

Starting today you can reuse complex functionality written by someone else instead of reinventing the wheel by writing it yourself.

Want to know how? Read this article and check out this example.

Need a specific npm module but can’t find what you’re looking for? Let us know via our Package Manager so we’ll be able to add it to the list.

7 Likes

Really appreciate this. Thank you.

Awesome work excited!!
#gameChanger
Thank you

This seems like an awesome feature! Any ideas on how long fulfilling a new npm package request might take? I have requested that a package be included, but I did not receive any indication on what the length of time this might take to process. Is it an hour, a day, a week, a year? Will I get notified when the package is there or do I have to keep looking to see if it is included? Not trying to be snarky at all…just trying to set my expectations as to when I can expect to have access to the modules I need. Very cool feature!

Hi Jay!

Currently it will probably take a couple of weeks until we’ll update the list. Going forward from there it will be MUCH faster.

I’ll update on the Forum once a new batch of packages will be added.

Awesome! Actually I just got a notification from the Wix team that my requested library was added. Just to set expectations for others, for me it was indeed a couple of weeks from request until the library I requested was added. Sounds like this timeline might improve going forward. Anyway…I should now be off to the races. Thank you Wix for adding this great feature!

Is there any documentation on how to use the pdfkit module? There is no import statement defined in their external reference documents. Instead they use require, which is not defined in our nodeJS backend code. Here is a link to the documentation on the pdfkit library. http://pdfkit.org/docs/getting_started.html

You can use require even though it’s flagged as an error.


The error is just an editor issue which will be fixed sometime.

See the Example: Google Sheets NPM where require is used for the Google API.

@yisrael-wix Thanks Yisrael, that’s a strange issue. I think given how intimately familiar you have to be with wix backend code to understand that it’s not an issue, it would be good to get that fixed.
I have a follow on question. If a node package is not currently available through wix, is there a work around? Specifically, I am looking for the ‘blob-stream’ package which I believe I need in order to create a link to a pdf I have generated with pdfkit. Can I simply copy the .js file of the ‘blob-stream’ package into a .js backend file I create and then import it?
Like so:
import blobStream from ‘backend/blob-stream’;

The blob-stream JS file is one that I found on github.

@ecurtiss81 Feel free to send your NPM package request to support.

I’m currently unable to submit a node package request using the form - the “Submit” button is greyed out. I would like to request the Coinbase Pro node module please.

Many thanks

Hi Edward,

My assumption is that the Submit button was greyed out since “Coinbase Pro” contains a space in the text (npm names does not contain any space chars as part of their names).
Having said that I’ve submitted a request for “coinbase-pro” and it will be reviewed as part of the next package bulk to be added.

I was also wondering if you have an idea of roughly how long it will take for it to become available? Is it a matter of days or weeks? Many thanks again

Hi, I’m still new to using SDK’s and was wondering if you were familiar with WIX MP’s library. I would like to use the FileImport method found here:


But I’m not sure exactly how to go about doing it. This was my best shot at it, but I don’t know how to get rid of the undefined errors for ExternalAuthorization and Destination. Also the last line that’s commented out also gives me an “unexpected :” error. I’m just trying to dynamically download files (images) from my Dropbox onto the Wix Media Manager, and I’ve exhausted pretty much every other solution I can think of. Any help would be appreciated and apologies in advance if I’m doing this completely wrong.

Hi Shiran, just wondering how soon I should expect to have access to the module. I notice there have been no new packages added since 11th of June, is there an expected time until the next lot of packages are added? I would highly appreciate a response. Thanks

Hi,
Usually it takes a few days to add the new requested packages, right now there is maintenance but it will be solved soon.

@embsats your package was added :slight_smile:

@_or Brilliant thanks for letting me know

@_or I’ve just gotten round to attempting to integrate the Coinbase Pro API module into my site but I’m having issues with the setup.

When I attempt to create a PublicClient object in my backend ‘coinbaseProAPIModule.jsw’ using the standard method indicated in the API docs:

const CoinbasePro = require('coinbase-pro');
const publicClient = new CoinbasePro.PublicClient();

I get the following error:

Error loading web module backend/coinbaseProAPIModule.jsw: Cannot read property 'PublicClient' of undefined

I cant seem to find a solution and I’m wondering if it could be something to do with how the node module was added to Corvid.
If I’m missing something, I’d really appreciate some pointers. It seems to me like the module hasn’t been imported correctly but I have no idea how to solve this.
Thanks

Shiran,

This is good news, but I must be a bit clueless because I cannot locate the Package Manager anywhere in the Wix dashboard or editor. How exactly can I find it in Wix?