0

I am getting error as Error parsing file: LWC Metadata Xml Parser: Unhandled XML element: targetLightningComponentBundle Please find code below

<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>48.0</apiVersion>
    <isExposed>true</isExposed>

    <targets>
        <target>
        lightning_AppPage
        lightning_RecordPage
        lightning_HomePage
    </target>
    </targets>
</LightningComponentBundle>

enter image description here

2 Answers 2

3

You are making an syntax error. You need to do like below:-

<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>48.0</apiVersion>
    <isExposed>true</isExposed>
    <targets>
        <target>lightning__AppPage</target>
        <target>lightning__RecordPage</target>
        <target>lightning__HomePage</target>
    </targets>
</LightningComponentBundle>

targets:-Specifies which types of the Lightning page the component can be added to. If you want your component to appear in the Lightning App Builder or in Community Builder, specify at least one Lightning page type. Supports the target subtag.

target:- A Lightning page type.

Reference:- Configuration File Tags

1

There should be double underscore (__) in between lightning and AppPage.

Like this.

<targets>
        <target>lightning__RecordPage</target>
        <target>lightning__AppPage</target>
        <target>lightning__HomePage</target>
        <target>lightningCommunity__Page</target>
        <target>lightningCommunity__Default</target>
        <target>lightning__Tab</target>
</targets>

You must log in to answer this question.

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