0

I want to include a custom JS and a custom html tag in salesforce lightning component. For example: I want in include a JavaScript webcomponent in LWC. So I need to include a custom js file and custom html tag in component cmp file. But currently cmp file support only some set if html tags.

1 Answer 1

0

You're supposed to upload the 3rd party library as a static resource and then reference it in aura/lwc. Exact syntax varies a bit. Or (in aura) you can use https://developer.salesforce.com/docs/component-library/bundle/ltng:require/documentation to load something that will effectively end up in an iframe. (You tagged lwc but your post keeps talking about aura's cmp file...)

3rd party libraries might fail to execute properly due to lightning locker (Salesforce disabling unsafe elements of JavaScript) or "shadow DOM" limiting access to some components internal styling, html and events.

It's a big topic, hard to give you good advice. Try something and post errors you encounter, if any?

https://developer.salesforce.com/docs/component-library/documentation/en/lwc/lwc.js_third_party_library

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.