TransWikia.com

Lightning Web Component is not available in App Builder when deploying from VS code

Salesforce Asked by Rachit on December 12, 2021

I am used to of ‘The Welkin Suite’ editor for official development. I am not frequent user of VS code. Only using VS code for personal use. Yesterday I observed weird issue while deploying LWC component to my playground org.

I did copy paste code(bikeCard component) from trailhead(below link) and it deployed but was not available in AppBuilder.
https://trailhead.salesforce.com/content/learn/modules/lightning-web-components-basics/push-lightning-web-component-files

I checked the config file and change the version as well but didn’t work. Then I deploy same code based from ‘The Welkin Suite’ and able to see component in App Builder.

Please let me know if anyone faced same issue and have solution. Otherwise I will report bug to VS code.

bikeCard.html

<template>
    <div>
        <div>Name: {name}</div>
        <div>Description: {description}</div>
        <lightning-badge label={material}></lightning-badge>
        <lightning-badge label={category}></lightning-badge>
        <div>Price: {price}</div>
        <div><img src={pictureUrl}/></div>
    </div>
</template>

bikeCard.js

import { LightningElement } from 'lwc';
export default class BikeCard extends LightningElement {
   name = 'Electra X4';
   description = 'A sweet bike built for comfort.';
   category = 'Mountain';
   material = 'Steel';
   price = '$2,700';
   pictureUrl = 'https://s3-us-west-1.amazonaws.com/sfdc-demo/ebikes/electrax4.jpg';
 }

bikeCard.js-meta.xml

<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
    <!-- The apiVersion may need to be increased for the current release -->
    <description>Description for Bike</description>
    <masterLabel>bikeCard</masterLabel>
    <apiVersion>48.0</apiVersion>

    <isExposed>true</isExposed>
    <targets>
        <target>lightning__AppPage</target>
        <target>lightning__RecordPage</target>
        <target>lightning__HomePage</target>
    </targets>
</LightningComponentBundle>

One Answer

If you have this "Experimental: Deploy Retrieve" setting enabled in VS Code Salesforce settings you will see this behavior of isExposed not being deployed with the component to the org, effectively hiding it.

If you have this setting enabled in VS Code, disable it.

"salesforcedx-vscode-core.experimental.deployRetrieve": true

There is an issue documented for the bug: https://github.com/forcedotcom/salesforcedx-vscode/issues/2302

enter image description here

Answered by Mark Pond on December 12, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP