We'll introduce you to packages and show you how they make it easy to share and reuse code across experiences and consume any of the hundreds of thousands of open-source NPM projects.
Packages are like code building blocks. You can publish a package that solves a particular problem and then reuse it again and again across multiple experiences.
At its most basic, a package is a folder with a package.json file in it. It must have a name
, and a version
, and to be useful it should point to a file containing some javascript code.
Qubit has built-in support for packages, meaning that you can:
There are three types of package made available through this feature:
We have a growing number of private packages, designed specifically for make building experiences easier.
These are prefixed with the Qubit scope, e.g. @qubit/poller
.
TIP: Each package has a readme file that explains its purpose and how you might use it, with practical examples. To access the file, select the documentation link: .
You can also access a special private scope that you can publish your own packages to. Once done, you can reuse packages across all of your organization's properties.
See Using a private package scope.
We also integrate with npm, which hosts hundreds of thousands of useful open source packages that you can use.
WARNING: Your use of the npm Registry is governed by the terms and licenses defined by npm Inc. These public packages are not tested or validated by Qubit and that we therefore cannot accept any liability or obligation in relation to their use.