0

I have tried to integrate twilio video into salesforce console . I managed to achieve this by building a react app and using lightning:container . The reason to do so is twilio-video was offered as a cjs package and there was no ES6 equivalent i could use to import it.

Is there a specific build configuration i can use that can convert packages similar to twilio-video to a bundle that i can deploy to salesforce and be able to interact with it natively without a lightning:container ?

2
  • i am not really getting your question to be honest. Do you want to know if there is a way to transform any package to native lwcs? somehow your headline does not match the content of your post
    – Renji-xD
    Jul 15 '19 at 13:52
  • I want to use a cjs module within salesforce lwc and want to know if there is a way to use any of the popular bundlers to achieve it .
    – Sid
    Jul 15 '19 at 14:34
0

You can use cjs modules as a static resource. See https://developer.salesforce.com/docs/component-library/documentation/lwc/lwc.create_third_party_library.

4
  • When i tried to load the min.js from dist of github.com/twilio/twilio-video.js/archive/2.0.0-beta12.zip , the load fails without any specific error . when i handle the exception it just shows undefined. is there any way to debug this load ?
    – Sid
    Jul 15 '19 at 15:25
  • you can pause on exceptions via browser devtools - your library is using apis which are not supported in lockerservice. So no "native" support with lwc at all - workaround like alyways in that case aura component with max version of 39, lightning:container or iframed visualforce page
    – Renji-xD
    Jul 15 '19 at 15:57
  • There seems no easy way to find out if a library is compatible with locker service . Is there any way am missing ?Secondly if the loadScript fails because of locker service issue it doesn't give any errors around it . Is there any alternative like browserify equivalent that we can use to rebuild the library compatible with lwc and locker service ?
    – Sid
    Jul 16 '19 at 16:32
  • Try the Locker Console (developer.salesforce.com/docs/component-library/tools/…) and Locker API viewer (developer.salesforce.com/docs/component-library/tools/…). These combined with the tip above about pausing on (un)caught exceptions should be sufficient to tell you if a library is Locker compliant and, if not, why. Jul 17 '19 at 2:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.