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

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

| improve this answer | |
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>
| improve this answer | |

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.