10

Well understand that LWC are supported within Community yet cannot find a way to get the component in the Builder. Any special configuration param to include somewhere like for LC where we were supposed to use implements="forceCommunity:availableForAllPageTypes" access="global"?

14

Yes, you have to handle it differently. For LWC in the community we have to edit the configuration file named as file—<component>.js-meta.xml

**

To make your component available in the Components tab in Community Builder, define lightningCommunity__Page in targets. Without this tag, your component can’t appear in Community Builder.

**

Config file Code:

<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="helloWorld">
    <apiVersion>45.0</apiVersion>
    <isExposed>true</isExposed>
    <masterLabel>Hello World</masterLabel>
    <targets>
        <target>lightningCommunity__Page</target>
        <target>lightningCommunity__Default</target>
    </targets>
    <targetConfigs>
        <targetConfig targets="lightningCommunity__Default">
            <property name="string" type="String" default="jsMetaValue"></property>
            <property name="boolean" type="Boolean" default="true"></property>
            <property name="integer" type="Integer" default="5"></property>
            <property name="picklist" type="String" default="value3" datasource="value1,value2,value3" />
        </targetConfig>
    </targetConfigs>
</LightningComponentBundle>

SRC: https://developer.salesforce.com/docs/component-library/documentation/lwc/lwc.use_config_for_community_builder

  • 1
    Just to clarify, this config file is required for all LWC's. Not just for community. In other words this is the same config file required to surface LWCs to app builder, record home, etc. It's just that the targets shown above are additional configs to add to surface the component into communities. The way you word it (and indeed in the docs) you make it sound like the config file is special for an LWC in communities. – pchittum Jan 7 at 13:07
  • Hi @pchittum , I have updated my answer. Thanks for notifying – Pranay Jaiswal Jan 8 at 11:26

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.