Add Components to Managed Packages

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.

To add components to a package, see Add Components to Your Package in Salesforce Help.

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.

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

By default, LWC doesn't automatically enforce managed package licensing. Lightning web components in a managed package can be seen and used by users who don’t have active licenses for that managed package, and can be seen and used 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