Add Components to Managed Packages

Where possible, we changed noninclusive terms to align with our company value of Equality. We maintained certain terms to avoid any effect on customer implementations.

A managed package ensures that your application and other resources are fully upgradeable.

To create and work with managed packages, use a Developer Edition organization and register a namespace prefix. A managed package includes your namespace prefix in the component names and prevents naming conflicts in an installer’s organization.

A custom Lightning web component can’t reference a Lightning web component installed from a managed package. See Component Namespaces.

AppExchange partners have two types of managed packages to choose from: second-generation managed packages (2GP) and first-generation managed packages (1GP). When working with managed packages, follow these guidelines.

When you add a component to a package, other components referenced by the component and any resources imported with @salesforce/* are automatically included. For more information, see @salesforce Modules.

After a package is released, the component name is locked, but the package developer can still edit these values in a component’s configuration file.

  • apiVersion
  • description
  • isExposed (can only change from false to true)
  • masterLabel
  • targetConfigs
  • targets

Keep these considerations about the isExposed field in mind when working with 1GP, 2GP, and unlocked packages.

  • If isExposed is false, the package developer can remove configuration targets and a public (@api) property from a component.
  • If isExposed is true and the component is in a published managed package, the package developer can’t remove configuration targets or a public (@api) property from a component. This restriction is enforced even if the target or public property was added after the most recent publication of the package.
  • When you delete a Lightning web component with an isExposed value of true, we recommend a two-stage process to ensure that the deleted component has no dependencies on the other items in the package. See Remove Components from Second-Generation Managed Packages.

By default, LWC doesn't automatically enforce managed package licensing. Users can see and use Lightning web components in a managed package even if they don’t have active licenses for that package. Users can also see and use Lightning web components in a managed package after a trial of that managed package expires. AppExchange partners are responsible for enforcing package licensing in their components.

We recommend that you use an Apex controller that calls either the UserInfo.isCurrentUserLicensed(namespace) or UserInfo.isCurrentUserLicensedForPackage(packageID) methods. If false is returned, don't render the component. Instead, show a message informing the user they aren't licensed for the managed package.

See Also