2

I want to use the below npm package 'wordwrapjs' in a lwc Salesforce component but lwc does not support the out of the box. Is there an easy way to convert an npm module into a lwc component?

Guess I can manually copy and add in the js from the npm module bit by bit until it works but would be useful if there was a more automated approach.

https://www.npmjs.com/package/wordwrapjs

Andrew
  • 71
  • 4
  • Have you tried uploading a static resource with the version that has "import" usage examples and loading that? Any errors? Can you enable "lightning web security" or are you stuck with lightning locker? – eyescream Oct 25 '22 at 16:41
  • I also have the same question did you found the way @Andrew to use node modules in LWC? – Jon Snow Feb 21 '23 at 10:01
  • @JonSnow in the end I just manually converted the JS from the node module into a new LWC component. This worked Ok for me but it might be a hassle if the module you want to use large. – Andrew May 02 '23 at 13:26

0 Answers0