0Pricing
Vue Academy · Lesson

Publishing to npm and Semantic Versioning

package.json fields (main, module, exports), changelogs, semantic-release, npm publish flow.

Preparing to Publish

Publishing makes your library installable via npm install. Before that, package.json must declare the entry points correctly and you must control what files ship.

main and module

main points to the CommonJS build for older tools; module points to the ESM build so modern bundlers pick the tree-shakeable version.

{
  "main": "./dist/my-ui-lib.cjs.js",
  "module": "./dist/my-ui-lib.es.js"
}

All lessons in this course

  1. Vite Library Mode Configuration
  2. TypeScript Declarations for Component Libraries
  3. Tree-Shaking and Auto-Import
  4. Publishing to npm and Semantic Versioning
← Back to Vue Academy