I have been trying to create a new Visualforce page with LWC but I am always getting a GACK, maybe I am messing up with something?
I am using Visual Studio Code to implement this, so I have created a new Lightning App:
applications/lwcComponents.app:
<aura:application extends="ltng:outApp" access="global">
<aura:dependency resource="lightning:button"/>
</aura:application>
applications/lwcComponents.app-meta.xml
<?xml version="1.0" encoding="UTF-8"?>
<CustomApplication xmlns="http://soap.sforce.com/2006/04/metadata">
<defaultLandingTab>standard-home</defaultLandingTab>
<isNavAutoTempTabsDisabled>false</isNavAutoTempTabsDisabled>
<isNavPersonalizationDisabled>false</isNavPersonalizationDisabled>
<label>lwcComponents</label>
</CustomApplication>
And a new Visualforce page:
pages/testButton.page:
<apex:page >
<apex:includeLightning />
<div id="lightningvf" />
<script>
$Lightning.use("c:lwcComponents", function() {
$Lightning.createComponent("lightning:button",
{ label : "Press Me!" },
"lightningvf",
function(cmp) {
console.log("button was created");
}
);
});
</script>
</apex:page>
pages/testButton.page-meta.xml
<?xml version="1.0" encoding="UTF-8"?>
<ApexPage xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>48.0</apiVersion>
<availableInTouch>false</availableInTouch>
<confirmationTokenRequired>false</confirmationTokenRequired>
<label>developmentStatus</label>
</ApexPage>
When trying to run the Visualforce page in browser, this is what I am getting:
An internal server error has occurred
Error ID: 188429498-1091988 (-1249547377)
As far as I can see in the Chrome Network tab, the problem is the $Lightning.use
method is calling an URL which is throwing this error.
Thank you!