Posts

Showing posts with the label third party

Adding NPM module into LWC

Image
Importing NPM module into LWC Hi Folks, I am back with another post. This time I will be discussing the topic of how to add an NPM module into LWC. Although we all know that to make any 3rd party javascript work in Salesforce we need to have it into Static Resource. But I came into a strange situation wherein I had to use an npm module into LWC.  The issue that I was facing was that the NPM module was having several dependant files which were scattered into several folders and it would have taken me ages to read through all the codes, find the dependency and create a single JS file that is uploadable to static resource. After researching a lot got to know about the Browserify tool ( webpack is also there but browserify is easy to use). Using this tool you can just let the package know which JS file is the source file and  Browserify  will do the magic for you and create a single js file. Enough of talking. Now let's get to the technicalities with an example. :) I will d...