13

I understand that Lightning Web Components (LWC) are supported within Community/Digital Experience, but I cannot find a way to get the component in the Builder. Is there any special configuration param to include similar for how Aura/Lightning Components used:

implements="forceCommunity:availableForAllPageTypes" access="global"?

1 Answer 1

22

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

3
  • 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, 2019 at 13:07
  • Hi @pchittum , I have updated my answer. Thanks for notifying Jan 8, 2019 at 11:26
  • You have to include lightningCommunity__Default even if you only want it on a community record/object page? That seems silly.... but yes, this resolved my "The 'property' tag isn't supported for lightningCommunity__Page" 👍 Feb 23, 2021 at 22:27

You must log in to answer this question.

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