The complete solution to build and ship Nuxt modules.
- Builds modules for Nuxt 3 and later, with no configuration for the module starter layout
- Builds with tsdown through the
builder()plugin: bundles the module entry, and transpiles the runtime directory file by file - Generates declarations against the module's own
.nuxt, for.tsand.vuefiles alike - Writes the type shims that give
nuxt.configautocompletion for the module's options and hooks - Lets a playground run the module's sources while
package.jsonpublishesdist, and checks the published paths before every build
Create a module from the module starter:
npm create nuxt -- -t module my-moduleBuilding a module requires Node ^22.18.0 || >=24.0.0, with tsdown and typescript installed alongside @nuxt/module-builder. Apps that install a built module need Nuxt 3 or later.
- Getting started
- Project structure
- Commands:
tsdown,build, andprepare - Develop and publish: source exports, the playground, and releasing to npm
- Configuration:
builder()intsdown.config.ts, extra entries, and the deprecatedbuild.config.ts - TypeScript: the module's
tsconfig.json, and its declarations - Build output
- Exports: subpath exports, including runtime components
- Transpiling a directory: the
transpileDirrolldown plugin - Upgrading to v2
For writing the module itself, read the Nuxt Module Author Guide.
- Clone repository
- Enable Corepack using
corepack enable - Install dependencies using
pnpm install - Try building example module using
pnpm example:build
Pages in docs/ are written for nuxt.com, so links between them use nuxt.com paths.
MIT - Made with 💚