Configuration of an LWC

By in
721
Configuration of an LWC

A configuration file is required for each Lightning Web Component. In addition to supported targets and the design configuration for Lightning App Builder and Experience Builder, the configuration file defines the metadata values for the component.

MyComponent.js-meta.xml is an example of a component.js-meta file used in configuration files.

Along with the other component files, push the configuration file to your org from the component’s project folder.

The simplest config file is shown here.

LWC Configuration
Image Source: SFDCpoint

 

<?xml version=”1.0″ encoding=”UTF-8″?>

<LightningComponentBundle xmlns=”http://soap.sforce.com/2006/04/metadata”>

<apiVersion>45.0</apiVersion>

<isExposed>false</isExposed>

</LightningComponentBundle>

 

Elements of XML Configuration Files

A configuration file with the name “component” must be present in every Lightning web component folder. js-meta.xml. Targets, as well as the design configuration for the Lightning App Builder and Experience Builder, are defined in the file’s metadata values for the component.

 

apiVersion

Minimum version 45.0 of the Salesforce API. The component always uses the most recent versions of the Lightning Data Service and underlying Lightning components, regardless of the apiVersion. The org-level setting for the Lightning Locker version is independent of the component apiVersion.

 

Capabilities

A component can perform a capability, as opposed to a target, which specifies the application of a component.

The capability subtag is supported.

 

Capability

Valid values include.

 

lightningCommunity__RelaxedCSP

Enables a managed package-installed component to function in an Experience Builder site with Lightning Locker deactivated. Developers of managed packages can choose to execute their Lightning web components on a website with Lightning Locker turned off by using this setting.

 

Description

A succinct description of the element, often one sentence long. The explanation is displayed as a tooltip in Lightning App Builder and Experience Builder as well as in list views like the list of Lightning Components in Setup.

 

Conclusion

In this way, we can make configurations related to the bundle of Lightning Web Components using the configuration XML file.

 

Additional Resources

Cover Photo by David Bruno Silva on Unsplash

Leave a reply

Your email address will not be published. Required fields are marked *