Best Practices for Unlocked Packages
We suggest that you follow these best practices when working with unlocked packages.
-
We recommend that you work with only one Dev Hub, and enable Dev Hub in a production org.
-
The Dev Hub org against which you run the
sf package createcommand becomes the owner of the package. If the Dev Hub org associated with a package expires or is deleted, its packages no longer work. -
Use care in deciding how to utilize namespaces. For most customers, we recommend working with no namespace or a single namespace to avoid unnecessary complexity in managing components. If you’re test-driving unlocked packages, use a test namespace.
Use real namespaces only when you’re ready to embark on a development path headed for release in a production org.
You can’t install a no-namespace, unlocked package into any org with a namespace (for example, a scratch org with a namespace).
-
Include the
--tagoption when you use thesf package version createandsf package version updatecommands. This option helps you keep your version control system tags in sync with specific package versions. -
Create user-friendly aliases for packaging IDs, and include those aliases in your Salesforce DX project file and when running CLI packaging commands. See: Package IDs and Aliases for Unlocked Packages.