8

I'm using Lightning Out in order to render my Lightning Components inside a Visualforce page.

<apex:page showHeader="true" sidebar="true">
  <apex:includeLightning />

  <div id="lightning" />

  <script>
      $Lightning.use("c:MyLightningOutApp", function() {
        $Lightning.createComponent("c:myComponent",
        {},
        "lightning",
        function(cmp) {}
        );
      });
  </script>
</apex:page>

Since I'm creating a Managed Package, my hope was that I would be able to use this approach to save on development time, while still allowing my subscribers to use the package in Salesforce Classic.

However, it seems that my Visualforce page is not able to render out Lightning Components without setting up the "My Domain" first on the subscriber's org. So, my question is, is there a way to use Lightning Out without setting up "My Domain"?

2 Answers 2

4

No. Lightning component won't work without setting my domain.

There are many reasons that My Domain is required and lightning component will not work unless you set a domain.

Useful link - Knowledge Article - My Domain Lightning Components

4
  • Thanks for your answer. I was aware of this requirement for Lightning Components, but I was hoping that there was some way to get around this when using Lightning Components inside Lightning Out.
    – smukov
    Jun 14, 2017 at 18:54
  • No. Eventually you are using lightning component itself in your lightning out app, so you have to set up the domain. Jun 17, 2017 at 18:54
  • Why then this works in non-packaged org?
    – Patlatus
    Jan 4, 2021 at 11:36
  • This link is broken in the answer.
    – Patlatus
    Jan 4, 2021 at 11:37
0

It is possible to render Lightning components without My Domain feature.

Please verify the code of your dependency app MyLightningOutApp.

If it has the following code

<aura:application extends="ltng:outApp"> 
    <aura:dependency resource="c:lwcComponent"/>
</aura:application>

then it should be updated to provide global access

<aura:application access="GLOBAL" extends="ltng:outApp"> 
    <aura:dependency resource="c:lwcComponent"/>
</aura:application>

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .