In this section we explore how to publish your library packages to the organization’s registry.
The NPMRC token grants access to the organization’s registry. Please follow up Adding token to connect to Azure Artifacts to make sure you have configured the token correctly.
package.json
{
"name": "vite-lib-demo",
"private": true,
"version": "1.0.0",
"type": "module",
// We're packing the dist folder
"files": [
"dist"
],
"main": "./dist/vite-lib-demo.umd.cjs",
"module": "./dist/vite-lib-demo.js",
"exports": {
".": {
"import": "./dist/my-lib.js",
"require": "./dist/my-lib.umd.cjs"
}
},
// ... Package JSON config
}
After finishing the previous steps:
npm version version-number
to specify a version of your package; example: npm run 1.0.1
.npm publish
and now you’re done!